473,224 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

FireFox window.event


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
Jul 23 '05 #1
3 27154


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

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
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

"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:41***********************@newsread4.arcor-online.net...


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

--

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

Jul 23 '05 #3
On Mon, 6 Dec 2004 07:07:35 +0100, Søren M. Olesen <sm******@hotmail.com>
wrote:
[...] 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.
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Perttu Pulkkinen | last post by:
I have different functions that receive window.event as parameter. Functions are used like this: <input type="text" id="x" onkeypress="return onKeyCurrencyCheck(ev, 'x')" onblur...
3
by: niconedz | last post by:
Hi The following code works fine in IE but not Firefox. It's a little script that zooms an image and resizes the window to fit. Can anybody tell me what's wrong? Thanks Nico == btw.....
10
by: Paul Gorodyansky | last post by:
Hi, Ran into the problem today - in INPUT field Firefox executes clean-yp of the content if a user presses Esc, _before_ control goes to the code via onkeydown - and search showed that it's a...
7
by: Coder | last post by:
Hi I have the following code in java script, it is not giving proper output in FIREFOX but running fine in IE... can anybody help me out to make this run in FIREFOX . <script...
4
by: tcole6 | last post by:
My problem appears to be Firefox specific. I have a hyperlink that loads a new window. This window contains hyperlinks that call javascript functions in the parent window and then closes the...
11
by: Krij | last post by:
Hi! Here's a training case at school. The function will animate a table cell in IE: function chgColor(){ var thistag, parenttag; thistag = window.event.srcElement.tagName; if(thistag ==...
1
by: lwenkel | last post by:
This is what should happen in Firefox - this is in IE: http://www.sacu.com/locations/locate.asp This is the javascript that manupulates the images. It is slightly modified from the IE version. ...
1
by: nebulus | last post by:
I'm working on a web app that under normal circumstances will be happy with the Session_OnEnd event, but when a user leaves a page by closing the browser by either Alt+F4 or just hitting the "X",...
1
by: jayvardhanpatil | last post by:
Hi All, I'm trying to position a dialog at my mouse position in firefox. I have one image control. On mouseover of image I call captureMouse() to get mouse position and after click on image I...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.