[thelist] [JS] window.onload is a liar...

liorean liorean at f2o.org
Tue Mar 16 02:23:03 CST 2004

Tom Dell'Aringa wrote:
> I'm trying to use window.onload but it doesn't function correctly. It
> tells me that my form isn't loaded when I call my function like so:
> window.onload = BuildSelect(arr);
> If I use a plain old onload="BuildSelect(arr);" in the BODY tag, it
> works fine.
> What is the difference? Why is the first method really not firing at
> onload? This does not work in either IE or Gecko...

window.onload should be a function - it will trigger when the document 
has loaded. You, however, assign it the return value of a function.


will assign the function itself to the onload handler. However, you are 
losing the argument if you do thus. How to fix that?


David "liorean" Andersson

ViewStyles, ViewScripts, SwitchStyles and GraphicsInfo bookmarklets:
<http://codingforums.com/> <http://yourmusicforums.com/>

More information about the thelist mailing list