Solved

Is there reference for the javascript event handler arguments?

Posted on 2015-02-11
6
91 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
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

825 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