Event object in javascript is not working

RESOLVED WORKSFORME

Status

()

Firefox
General
RESOLVED WORKSFORME
10 years ago
10 years ago

People

(Reporter: amogh, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

10 years ago
User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Build Identifier: windows 2003 R2 SP2

In my application there is a table with check all button.When this button is clicked then all the check boxes below are checked.In the function handleOnClick i have written following line
"if (!eventObj || typeof eventObj.keyCode !== typeof 1) { eventObj = event; }"
In mozilla/firefox it is throwing a javascript error saying "event is not defined" the same is supported by IE.
Please anybody having its solution to replace this event object?

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Actual Results:  
Javascript error coming

Expected Results:  
javascript error should not occur

Updated

10 years ago
Duplicate of this bug: 401062

Comment 2

10 years ago
Look for articles, tutorials on the DOM 2 event method addEventListener, like:
Working With Events in Netscape 6
http://www.scottandrew.com/weblog/articles/events

event is a global variable in MSIE; not so in Mozilla-based browsers and those following DOM 2 events interface

Amogh, you posted only 1 line of code; no URL. So it's impossible to guide you any further.

Making your web page compatible with Firefox
http://www.reloco.com.ar/mozilla/compat.html

DOM:element.addEventListener
http://developer.mozilla.org/en/docs/DOM:element.addEventListener

For support on web authoring, I highly recommend that you first consult these:
1-
Using Web Standards in your Web Pages
http://developer.mozilla.org/en/docs/Using_Web_Standards_in_your_Web_Pages

2-
Mozilla Web Author FAQ
http://www.mozilla.org/docs/web-developer/faq.html

and then for coding assistance
3- MozillaZine Forum: web development and standards
http://forums.mozillazine.org/viewforum.php?f=25

Resolving as WORKSFORME
Status: UNCONFIRMED → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.