The Mouse Event Object Tutorial: JavaScript Events SyntaxIn HTML: <element onmouseenter="myScript"> Try it Yourself » In JavaScript: object.onmouseenter = function(){myScript}; Try it Yourself » In JavaScript, using the addEventListener() method: object.addEventListener("mouseenter"...
JavaScript Certificate Front End Certificate SQL Certificate Python Certificate PHP Certificate jQuery Certificate Java Certificate C++ Certificate C# Certificate XML Certificate FORUM ABOUT ACADEMY W3Schools is optimized for learning and training. Examples might be simplified to improve re...
Using Event Helpers Some types of events are fairly common, and jQuery provides shorthand helper functions to make your code a little easier to write and read. Some examples: hover(): use this instead of mouseover and mouseleave events click(): listens for click events dblclick(): listens ...
Return Value: A Boolean.Returns true if the CTRL key was pressed when a mouse event occurs. Otherwise it returns false. DOM Version: DOM Level 2 Events.Browser Supportevent.ctrlKey is a DOM Level 2 (2001) feature.It is fully supported in all browsers:...
JavaScript Certificate Front End Certificate SQL Certificate Python Certificate PHP Certificate jQuery Certificate Java Certificate C++ Certificate C# Certificate XML Certificate FORUM ABOUT ACADEMY W3Schools is optimized for learning and training. Examples might be simplified to improve re...
The horizontal screen pixel coordinate of the mouse pointer DOM Version: DOM Level 2 Mouse EventsMore ExamplesExample The differences between screenX and screenY and clientX and clientY: let sX = event.screenX; let sY = event.screenY; let cX = event.clientX; let cY = event.clientY; Try ...
Use thebutton propertyinstead Inherited Properties and Methods The MouseEvent inherits all the properties and methods from: The UiEvent The Event Object ❮ DOM Events❮ Event Objects Track your progress - it's free! Log inSign Up COLOR PICKER...
DOM Version:DOM Level 2Mouse Events. More Examples Example The coordinates of the mouse pointer while the mouse pointer moves: letx =event.clientX; lety =event.clientY; Try it Yourself » Example The differences between clientX and clientY and screenX and screenY: ...
The metaKey Property The shiftKey Property The Mouse Event Object Syntax event.altKey Technical Details Return Value:A Boolean. Returnstrueif the ALT key is pressed when a mouse event occurs. Otherwise it returnsfalse. DOM Version:DOM Level 2Mouse Events. ...
1 : Left mouse button 2 : Right mouse button 4 : Wheel or middle button 8 : Fourth button (Browser Back) 16 : Fifth button (Browser Forward) For a left-hand configured mouse, the values are reversed. DOM Version:DOM Level 3 Events ...