i just created the following testpage, which incorporates matts and spikes
suggestions.
and just to add to the mix ive put a pre existing onload handler, to see if
it actually gets replaced by either of the 2 methods. 

the result is that *all* 3 functions are called:
first the document.onload function gets called
then the mybodytag script gets called
then the pre existing onload function gets called.

<html>
<body id="mybodytag" onload="bodyonloadfunc()">
<Script>
function bodyonloadfunc()
{
alert('bodyonloadfunc');
}

function documentonloadfunc()
{
alert('documentonloadfunc');
}

document.onload=documentonloadfunc();
</script>

<script for="mybodytag" event="onload">
 alert('mybodytagonload');
</script>

</body>
</html>


-----Original Message-----
From: Steve D [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 18, 2002 12:25 PM
To: [EMAIL PROTECTED]
Subject: RE: [ cf-dev ] OT: javascript body onload question


Will changing the BODY onLoad function after it has been defined
actually make the BODY onLoad function run though ? Does anyone know if
the BODY onLoad event is run/captured as soon as the browser hits the
BODY tag, or after the entire page has loaded ? You can just use
document.onLoad as Matt suggested as a replacement for BODY onLoad.


> -----Original Message-----
> From: Stephen Fernandez [mailto:[EMAIL PROTECTED]] 
> Sent: 18 September 2002 11:47
> To: '[EMAIL PROTECTED]'
> Subject: RE: [ cf-dev ] OT: javascript body onload question
> 
> 
> cheers!
> 
> -----Original Message-----
> From: Matt Horn [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 18, 2002 11:38 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [ cf-dev ] OT: javascript body onload question
> 
> 
> document.onload='functionName();'
> 
> 
> At 11:36 18/09/02 +0100, you wrote:
> >does anyone know if its possible to set the body onload handler 
> >function using javascript after the <Body> tag has been defined?
> >
> >eg is something like this possible? if so whats the syntax?
> >
> >code code code code code code This email has been scanned 
> for viruses 
> >by
> >NetBenefit using Sophos anti-virus technology -- ** Archive: 
> >http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ 
> To unsubscribe, 
> >e-mail: [EMAIL PROTECTED] For 
> additional commands, 
> >e-mail: [EMAIL PROTECTED] For human help, e-mail: 
> >[EMAIL PROTECTED]
> 
> 
> -- 
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: 
> [EMAIL PROTECTED] For human help, e-mail: 
> [EMAIL PROTECTED]
> 
> 
> 
> This email has been scanned for viruses by NetBenefit using 
> Sophos anti-virus technology
> 
> 
> 
> This email has been scanned for viruses by NetBenefit using 
> Sophos anti-virus technology
> 
> 
> 
> -- 
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: 
> [EMAIL PROTECTED] For human help, e-mail: 
> [EMAIL PROTECTED]
> 


-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]



This email has been scanned for viruses by NetBenefit using Sophos
anti-virus technology



This email has been scanned for viruses by NetBenefit using Sophos anti-virus 
technology



-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to