Joern Nettingsmeier wrote:
> Joern Nettingsmeier again spoke too soon when he wrote:
>>> Good idea. I'm not that familiar with javascript. I am unable to get 
>>> it to work on body. I can get it to work on document however. Not sure 
>>> there is much of a difference in this instance between the two values.
>> i've done some experiments with this as well, and i've hit a snag:
>>
>> there can only be one such handler per element, and only one 
>> window.onload function. which means that it's not as modular as it 
>> looks: if two included scripts use the window.onload trick, one will 
>> have its function overwritten...
>> there is a better event handling mechanism available that avoids this 
>> problem (addEventListener()), but the joke that passes for a browser in 
>> redmond still does not support it :(
>> you could add global code to the included js like so:
>>
>> lenyaDisableBackspace();
>>
>> but it won't work either, because at the time it is executed, a <body/> 
>> node does not exist yet. hrrmpf.
>>
>> morale: your approach is more robust (but mine looks better :-D)
> 
> given that functions are objects in js, the following might work:
> 
> var somebodyElsesOnloadHandler = window.onload;
> window.onload = function() {
>    somebodyElsesOnloadHandler();
>    ourOwnStuff();
> }

See http://www.scottandrew.com/weblog/articles/cbs-events. This approach has
worked for us for years.

Hope this helps.
Markus Angst


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to