473,698 Members | 2,344 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FireFox window.event


Hi

In IE there seem to be a global variable window.event, holding the current
event....howeve r this dowsn't work in FireFox... is there a similar way to
get the current event??

TIA

Søren
Jul 23 '05 #1
3 27188


Søren M. Olesen wrote:

In IE there seem to be a global variable window.event, holding the current
event....howeve r 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.onevent name
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...somethi ng like window.event

Regards,

Søren

"Martin Honnen" <ma*******@yaho o.de> wrote in message
news:41******** *************** @newsread4.arco r-online.net...


Søren M. Olesen wrote:

In IE there seem to be a global variable window.event, holding the
current event....howeve r 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.onevent name
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******@hotma il.com>
wrote:
[...] I really looking for some other way to get hold of the
event...somethi ng 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
20766
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 ="onBlurCurrencyCheck(event, 'x')""> Works very well with IE, but window.event and maybe window.event.keycode too seems to be missing form firefox. Is there a workaround for this?
3
2955
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.. sorry for the long post ==
10
3046
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 known issue: https://bugzilla.mozilla.org/show_bug.cgi?id=236628 The bug is closed due to the inactivity (I've just written to the Submiter because apparently I don't have rights to re-Open)
7
9605
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 language="JavaScript"> var cntlName; var eleTarget = document.getElementById('hiding'); function showOrHide(){
4
5125
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 child window. The function that is called contains an XMLHttpRequest. My problem is that everything happens as it should, the innerHTML is changed by the results of the XMLHttpRequest and the child window closes. The problem is this, in Firefox,...
11
4083
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 == "TD"){ document.all(window.event.srcElement.sourceIndex).bgColor = "#3280ff";
1
6877
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. I can get the map images to display, but can not get them positioned properly nor can I move the black rectangle. Here is the code: // CREDITS: // MapBlaster by Urs Dudli and Peter Gehrig // Copyright (c) 2001 Peter Gehrig and Urs Dudli....
1
33174
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", I'll need to kill the session. Now, with the onbeforeunload event, I can handle this quite easily in IE, but in FireFox, it's another matter. For one thing, FireFox seems to empty out its event object on a page unload, so it's very hard to track...
1
2591
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 need to show the dialog with its topleft corner exactly from my mousepointer (On image) I did following work around It goes well with IE
0
8680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9030
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7738
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2335
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.