FireFox window.event

  • Thread starter Søren M. Olesen
  • Start date
S

Søren M. Olesen

Hi

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??

TIA

Søren
 
M

Martin Honnen

Søren M. Olesen wrote:

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);
}
};
 
S

Søren M. Olesen

Hi Martin

Thanks for your reply, however my problem is that my function is called from
some code that I didn't write (code from Infragistics), and they don't send
the event as a parameter, so I really looking for some other way to get hold
of the event...something like window.event

Regards,

Søren
 
M

Michael Winter

[...] 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,262
Messages
2,571,056
Members
48,769
Latest member
Clifft

Latest Threads

Top