permaculture playing cards*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Event parameter" Watch "Event parameter" New topic
Author

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
Marshal

Joined: Jan 10, 2002
Posts: 60792
    
  65

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