HighDots Forums  

Re: FireFox window.event

Javascript JavaScript language (comp.lang.javascript)


Discuss Re: FireFox window.event in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Martin Honnen
 
Posts: n/a

Default Re: FireFox window.event - 12-03-2004 , 07:05 AM








Søren M. Olesen wrote:


Quote:
In IE there seem to be a global variable window.event, holding the current
event....however this dowsn't work in FireFox... is there a similar way to
get the current event??
Event handlers have a parameter, in event handler attributes you can use
event
e.g.
<input type="button" onclick="alert(event.type);">
if you use script to set
element.oneventname
then you can choose the parameter name yourself e.g.
element.onclick = function (evt) {
alert(evt.type);
};
Of course for IE you need to continue to use window.event so you end up with
element.onclick = function (evt) {
if (!evt && window.event) {
evt = window.event;
}
if (evt) {
alett(evt.type);
}
};

--

Martin Honnen
http://JavaScript.FAQTs.com/


Reply With Quote
  #2  
Old   
Michael Winter
 
Posts: n/a

Default Re: FireFox window.event - 12-06-2004 , 06:33 AM






On Mon, 6 Dec 2004 07:07:35 +0100, Søren M. Olesen <smolesen (AT) hotmail (DOT) com>
wrote:

Quote:
[...] I really looking for some other way to get hold of the
event...something like window.event
You can't. The standardised event model only provides the event object as
an argument to the event listener. You'll have to modify the third party
code (if that's allowed, otherwise get them to patch it) to send the event
object when it calls your code.

[snip]

Mike


Please don't top-post.

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.