CodeIgniter Forums
[JS] How to detect current event of mouse with a html element ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: [JS] How to detect current event of mouse with a html element ? (/showthread.php?tid=24273)



[JS] How to detect current event of mouse with a html element ? - El Forum - 11-04-2009

[eluser]Berserk[/eluser]
hi there,
i'm trying to detect "current event" of mouse (hover, click,...etc) with an element in html using javascript. Anyone can tell me ? thanks


[JS] How to detect current event of mouse with a html element ? - El Forum - 11-04-2009

[eluser]umefarooq[/eluser]
hi check this article and example will help you

http://www.devirtuoso.com/2009/08/beginners-guide-to-jquery-mouse-events/


[JS] How to detect current event of mouse with a html element ? - El Forum - 11-05-2009

[eluser]mhel_dc[/eluser]
Code:
[quote author="Berserk" date="1257414412"]hi there,
i'm trying to detect "current event" of mouse (hover, click,...etc) with an element in html using javascript. Anyone can tell me ? thanks[/quote]

I suggest adding an EVENT PROPERTY in the HTML tag

Example :

add these following events in your html controls (if the control supports it)

onmouseover = javascript()
onmousedown = javascript()
onmouseup   = javascript()
onmouseout  = javascript()
onmousemove = javascript()

javascript() <- replace this with your javascript function

I guess you can now identify which events your mouse is doing.