tags:

views:

70

answers:

2

How would I go about developing cross-browser event triggering for mouse buttons (left, middle and right) in plain-vanalla JavaScript?

A: 

It would be strongly recommended you use a Javascript Library for this purpose.

Most popular being JQuery (recommended)

For additional libraries you can view the following what-is-the-best-lightweight-javascript-framework

Do you have a valid reason for not using any libraries...?

Regards

Gordon

gg
Please, stop asking that sort of questions, and better try answering mine.
David Gore
Fair enough... in reply to your question, open the jquery source code and copy the "cross-browser event triggering" code and paste it into your javascript file. Its cross browser, its been written and you can pretend its home-made...
gg
could you please show me which part of jQuery I should use and how to rebuild it so that I get exactly what I need. Thanks.
David Gore
Ridiculous? What's so ridiculous? I asked gg not to demand a valid reason from me because that doesn't pertain to my question.
David Gore
Sorry. Forget about it. Wrote this after I took the time to gather a few relevant links and saw that you accepted the "hey just copy jQuery's solution" answer. Which upset me a little after you wrote: I want to do it myself. btw. just copying the code and pretending it is home made would be a license violation too
jitter
He He!!! I am from Russia. A fat lot we care about license violations! =) But back to my business. I do not want just use what could/should be done myself. I study JS, so it is important for me to do things myself. Frameworks are good but they perhaps deprive me of understanding the real core of JS. And after all, I just don't need the whole libraly to do the triggering, do I?
David Gore
I was kidding about copying the code :) sarcasm, fail... :) I understand you would like to do this yourself, but I think you will find its a great amount of work with very little reward. Rather spend your effort on learning the good parts of Javascript, not the crappy dom aspect of it. JQuery is simply a tool that allows you focus on the good aspects and not worry about browser compatibility etc. Douglas Crockford has a really good book on Javascript called "JavaScript: The Good Parts". It's worth the read.P.S. jitter's answer should be marked as the correct one...
gg
+4  A: 

A few starting points

jitter
Very nice links. Not sure why this would not have been accepted (compared to the one that was). I just want to point out (to @David as well) that point #6 does not utilize any of points 1-5. @David: you're in for a big surprise when you see the approach jQuery took in simulating events.
Crescent Fresh
Upped you and commented that yours should be accepted as the correct one. More in scope with question.
gg