...

View Full Version : document.onload



bradeck
12-18-2003, 09:06 PM
I set up the following snippett:

<script>
function PageLoaded()
{
alert("test");
}
document.onload = PageLoaded;
</script>


Unfortunately, the alert is not being called. What am I doing wrong?

Additionally, if onload() is defined in the body tag, is there a way to add a call to what is already being called?

nolachrymose
12-18-2003, 09:11 PM
I believe it's window.onload and not document.onload.

Hope that helps!

Happy coding! :)

Kor
12-19-2003, 09:28 AM
if onload() is defined in the body tag,


actualy in body you can call (fire, if you want...), a function, not to define. and onload is an event handler, not a function onload(), if you use it that way:

<body onload="aFunction()">

is similar with

<script>
function aFunction(){
'
'
'
}
window.onload = aFunction;
</script>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum