This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Event parameter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Event parameter" Watch "Event parameter" New topic

Event parameter

Sen George
Ranch Hand

Joined: Sep 21, 2005
Posts: 76
The following code works but with one error. Error is that the argument "ev" is undefined. Please advise.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60765

IE does not follow the W3C standards for event handling. It makes the Event instance available at window.event instead of passing it to the listener.

So you could add code to the listener such as:to deal with this egregious behavior.

Also be aware that IE also populates the Event instance with non-standard properties. So you need to deal with that too!

Or (highly recommended!) use a library like jQuery for your event handling which hides these (and other) browser differences.

P.S. "ev"? What's wrong with "event"? Much more readable.
[ November 02, 2008: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Sen George
Ranch Hand

Joined: Sep 21, 2005
Posts: 76
Thank you for the clarification.
It is sorta covered in the JavaRanch Style Guide.
subject: Event parameter
Similar Threads
Is there something better then event.pageX/Y?
How to escape % in JSP
Browser coords in FF not working but working in IE
site development
position of HTML columns in pixels?