Forum Moderators: open

Message Too Old, No Replies

body.onload from external script?

Need to auto-execute external script

         

Peter72

10:34 pm on Mar 27, 2004 (gmt 0)

10+ Year Member



I am getting totally confused here (maybe because of the late hour, maybe my browsers are just getting instable...) but what I need is the following:

I need a way to auto-execute a script function after loading and after resizing of a page. This script is located in an external JavaScript file, and the event handlers have to be defined in the script file (the document itself can't have an onload attribute or script calls). The auto-loading function needs to be executed after the page has been built, since I need access to the clientHeight property...

Can anybody please help me?

Birdman

2:11 pm on Mar 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can put a line like this in youe external file to execute on an event:

document.onload = doMyFunction;

doMyFunction is the name of the function.

Birdman

Peter72

2:21 pm on Mar 28, 2004 (gmt 0)

10+ Year Member



Thanks, that works! I was focussing too much on getting body.onload to work, that I didn't look at document.onload or window.onload!