View Full Version : <body onload="some_function()"> question
Sawtooth500
07-10-2009, 03:52 AM
So I know that technically putting an event handler like onload into the body tag isn't good javascript practice, but if it works, is there any harm?
My javascript sucks in general and the "right" way to do it seems so much more complicated...
RysChwith
07-10-2009, 08:18 AM
It's somewhat situational, but the big problem I've always had with it is that it rapidly becomes clunky the more things you want to happen onload. Perhaps you only have the one function now, but then you add in an RSS feed and a Twitter feed and some happy little animation things and...
The event handlers, although a bit clunky at first, are much easier to maintain in the long run.
Rys
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.