Jump to content

HTML DOM example might need correcting

Recommended Posts

(I hope this is the right forum for this topic)Under the HTML DOM tutorial for Events, the first example doesn't seem to work right. It checks if the user is pressing the right mouse button by looking for a returned value of "2". If it doesn't get "2", it displays that the left button was pressed.However it always reported to me that I was pressing the left button. So I modified the code to see what numbers my mouse was returning and I came up with "1" for left, "0" for right (not "2") and "4" for the scroll wheel (the driver I have to use doesn't recognize a middle button). If these numbers are universal, then the code needs to be changed to reflect "0" for the right mouse button.

Link to post
Share on other sites

The numbers are not universal. It would probably be better to mention in the tutorial that detecting mouse clicks is on a per-browser basis, and some browsers (including Opera) do not even allow Javascript to receive events such as right-click. I'm not sure if the tutorial mentions that it is generally pretty useless to try and detect mouse clicks, but it pretty much is.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...