I'm not too sure how compatible this might be across different browsers,
but you could use the 'for' attribute of the script tag:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
        <title>Untitled</title>
</head>

<body id="mybodytag">

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

</body>
</html>

Spike

> -----Original Message-----
> From: Stephen Fernandez [mailto:[EMAIL PROTECTED]] 
> Sent: 18 September 2002 12:36
> To: Cfugdev (E-mail)
> Subject: [ cf-dev ] OT: javascript body onload question
> 
> 
> 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?
> 
> <html>
> <head></head>
> <body>
> code code code
> code code code
> <script>
> document.body.onload=somefunction();
> </script>
> 
> 
> 
> 
> 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]

Reply via email to