• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

body tag onload event does not fire

 
Ranch Hand
Posts: 282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I modified a page in an old application to add a body tag onload event. However, the body tag onload event does not fire. I traced the problem to the following line in some JavaScript menu code that is being included and executed in the page:

where f31 is a menu function.

If I remove the line to fire the window onload event, the body onload event successfully fires as I would expect. And curiously, if I change the window onload line to:

both the window and body onload events fire but this also results in a (yellow triangle with exclamation point) JavaScript error which is worse than the original problem.

This problem is occurring in IE6. I would appreciate any suggestions as to how to get around this.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
with move the body onload call to this line in the menu or move the menu call to the body onload.

You can only have one!

so it should either be

window.onload = function(){ foo(); bar();}

or

onload="foo();bar();"

Eric
 
Jay Damon
Ranch Hand
Posts: 282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Eric. One more question: Am I to understand that window onload and body onload are the same event?
[ April 16, 2007: Message edited by: Jay Damon ]
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic