Append function to onLoad

S

Steve Macleod

Hi,
I am writing a function which will be included on other pages. I need
to append a function call to the body onload event without disrupting
other function calls which may/may not be there. Does anyone know how
to achieve this?
 
E

Evertjan.

Steve Macleod wrote on 01 Oct 2006 in comp.lang.javascript:
I am writing a function which will be included on other pages.

Other?

Oh you mean in an include file.
I need
to append a function call to the body onload event without disrupting
other function calls which may/may not be there. Does anyone know how
to achieve this?

will this help?

======= test.html ===============
<body onload="alert('a');">

<script type='text/javascript'>

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

var x = window.onload
window.onload = function(){b();x();}

</script>
==================================
 
S

Steve Macleod

Yeah that is it!
simple really, I guess. Must have been at this too long!

Thanks for the help!
 
E

Evertjan.

Steve Macleod wrote on 01 Oct 2006 in comp.lang.javascript:
Yeah that is it!
simple really, I guess. Must have been at this too long!

Sorry, What are you talking about?

On usenet please always quote, usenet is not email.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top