Solved

Is there reference for the javascript event handler arguments?

Posted on 2015-02-11
6
94 Views
Last Modified: 2015-03-09
Hi Experts,

I am playing with HTML5 and javascript. I can find a very complete list of events in HTML5 elements (http://www.w3schools.com/tags/ref_eventattributes.asp). However, when I try to find out what these events can do, I found that it should be helpful if I have reference documents for the event handler arguments.

For example, if doMouseDown(event) function is the event handler of the mouse-down event of an element, then the event parameter should have pageX and pageY properties accessible in the handler.

Is there such a reference document? Where can I get it?
Thank you!
0
Comment
Question by:huangs3
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 9

Accepted Solution

by:
Brian Tao earned 500 total points
ID: 40604842
0
 

Author Comment

by:huangs3
ID: 40606317
Hi Brian,

In this link I can see the names of the events, but how do I know the accessible properties of the event argument?
For example, I can find that there is an "onmousedown" event, but how can I efficiently find out the event handler argument (let's say it is named "arg") has properties arg.pageX and arg.pageY returning the mouse coordinates?

Thank you!
0
 
LVL 9

Expert Comment

by:Brian Tao
ID: 40607727
The upper part of the page is like what you said, and events are categorized under sections.
In the lower part of the page, there are other sections for event methods and properties (which you called event arguments). They are with subjects "Event Object", "MouseEvent Object", "KeyboardEvent Object", ... and so on

All event handlers are passed with one argument, the event object.  With the argument (usually we put it as an "e", e.g. doMouseDown(e) using your example) you can get e.altKey, e.button, e.clientX, e.clientY, ... etc.
0
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 

Author Comment

by:huangs3
ID: 40654999
Brian's link doesn't show all the event object properties, but with the provided keyword "Event Object" I could find more references, such as:
http://www.javascriptkit.com/domref/domevent.shtml
http://www.javascriptkit.com/jsref/event.shtml
https://developer.mozilla.org/en/docs/Web/API/Event

Thank you!
0
 

Author Closing Comment

by:huangs3
ID: 40655003
sorry for the late response due to some perturbation on my side
0
 
LVL 9

Expert Comment

by:Brian Tao
ID: 40655211
Thanks for the points.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question