Solved

Is there reference for the javascript event handler arguments?

Posted on 2015-02-11
6
88 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
  • 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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 style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now