CodeIgniter Forums

Full Version: [JS] How to detect current event of mouse with a html element ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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

El Forum

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

http://www.devirtuoso.com/2009/08/beginn...se-events/

El Forum

[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.