Comments for Managing Multiple Javascript window.onload Functions
6 comments for this article.
Subscribe to the comments for this article
Posted: 2007-08-10 23:09:59 by Deb
I needed this exact fix and so far, on IE7 and FF2 on PC, it seems to work. Thanks!
Posted: 2007-08-27 03:31:43 by Mike
This makes a world of difference when including variable components into an application! Thank you :)
Posted: 2007-09-04 16:42:17 by Warwick
How does using onload=" ... " affect this code?
Posted: 2007-09-04 16:50:46 by lobo235 - Netlobo Staff Member
Using onload="..." in conjunction with this code can have two side effects. If you set an onload function manually and then call the womOn function it will overwrite your onload function and it will be forgotten. If you call womOn and then manually set the onload then the WOM will not work as it will have been overwritten by your manual onload.
I believe that any body.onload functions will work in conjunction with the WOM as the WOM uses window.onload.
I believe that any body.onload functions will work in conjunction with the WOM as the WOM uses window.onload.
Posted: 2008-01-31 13:21:48 by nomikos
Thanks lobo235!
BTW Sometimes not all functions are available on each page. Then:
for (var i = 0;i < woms.length;i++)
if (typeof woms[i] == 'function')
eval(woms[i]);
Right?
BTW Sometimes not all functions are available on each page. Then:
for (var i = 0;i < woms.length;i++)
if (typeof woms[i] == 'function')
eval(woms[i]);
Right?
Posted: 2008-01-31 13:24:57 by lobo235 - Netlobo Staff Member
nomikos,
That will work for many situations where the value in woms[i] is just the name of a function. However, if you have something like 'setFocus("username");' stored in woms[i] then the typeof() call will not return 'function'. You should be careful with this.
That will work for many situations where the value in woms[i] is just the name of a function. However, if you have something like 'setFocus("username");' stored in woms[i] then the typeof() call will not return 'function'. You should be careful with this.
Subscribe to the comments for this article
Post your comment for the Managing Multiple Javascript window.onload Functions article:
