Markus Angst wrote:
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
Okay, I was able to do this under Firefox:

window.addEventListener('load',LenyaDisableBackspace,false);

After changing the jx to do the same to load FCKeditor, that worked. But I can't get anything to work to register the events on the body. Whether it be body.addEventListener, or body.onkeypress, they just don't work. The only thing I've got to work so far is document.onkeypress. Perhaps I'm not getting the correct node to add my listeners to.

I've tried:
document.body
document.getElementsByTag('body')
document.getElementsByTag('body')[0]

Javascript isn't a language I know very well at all. Any help would be appreciated.

Richard

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

Reply via email to