gib65
07-19-2010, 08:28 PM
Hello,
I'm trying to run a javascript function on the website load. The website features a few things, however, that seem to be making this difficult.
Here's index.html (the relevant part):
<body style="background-image: url('background.jpg');" onpageload="javascript:getFilenameFromURL();">
and here's my function:
function getFilenameFromURL() {
window.alert("hello world");
}
As you can see, it's only built for testing purposes at the moment.
As it stands, this code doesn't do anything. I'm not getting the "hello world" alert on the page load that I would expect. On the other hand, I've been told to use onload instead of onpageload in the body tag, but that's where the interference with other page elements seems to come in. I'm using one of dynamic drive's motion galleries (this one: http://www.dynamicdrive.com/dynamicindex4/cmotiongallery.htm) and if I use onload, the gallery becomes unscrollable for some reason (but I do get my alert).
So I can have either a functional motion gallery or a functional onload function, but not both.
I would like to have both. Can anyone suggest why this is proving difficult?
Here's my website: http://www.surrealsource.com
I'm trying to run a javascript function on the website load. The website features a few things, however, that seem to be making this difficult.
Here's index.html (the relevant part):
<body style="background-image: url('background.jpg');" onpageload="javascript:getFilenameFromURL();">
and here's my function:
function getFilenameFromURL() {
window.alert("hello world");
}
As you can see, it's only built for testing purposes at the moment.
As it stands, this code doesn't do anything. I'm not getting the "hello world" alert on the page load that I would expect. On the other hand, I've been told to use onload instead of onpageload in the body tag, but that's where the interference with other page elements seems to come in. I'm using one of dynamic drive's motion galleries (this one: http://www.dynamicdrive.com/dynamicindex4/cmotiongallery.htm) and if I use onload, the gallery becomes unscrollable for some reason (but I do get my alert).
So I can have either a functional motion gallery or a functional onload function, but not both.
I would like to have both. Can anyone suggest why this is proving difficult?
Here's my website: http://www.surrealsource.com