Jump to content

HTML DOM example might need correcting


kwyjibear

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 comment
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 comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...