JavaScript onmouse Events Last Updated : 10 Feb, 2023 Comments Improve Suggest changes Like Article Like Report The onmouse event is used to define the operation using the mouse. JavaScript onmouse events are: onmouseover and onmouseoutonmouseup and onmousedownonmouseenter and onmouseleave JavaScript onmouseover and onmouseout: The onmouseover and onmouseout events occur when the mouse cursor is placed over specific element Example 1: These events do not require a mouse click to happen HTML <script type="text/javascript"> function over() { document.getElementById('key').innerHTML= "Onmouseover event has occurred"; } function out() { document.getElementById('key').innerHTML= "Onmouseout event has occurred"; } </script> <h2 id="key" onmouseover="over()" onmouseout="out()"> Original Text </h2> Output:  JavaScript onmouseup and onmousedown: Example: These events occur when a mouse click is encountered javascript <script type="text/javascript"> function up() { document.getElementById("gfg").innerHTML="Welcome to GFG"; } function down() { document.getElementById("gfg").innerHTML = "Goodbye"; } </script> <p id="gfg" onmouseup="up()" onmousedown="down()">Hello</p> Output:  JavaScript onmouseenter and onmouseleave: The onmouseenter event occurs when the mouse is placed on the element and stays until the mouse is removed from the element onmouseleave event occurs as soon as the mouse is removed from the element Example: These event do not require mouse click to happen javascript <script> function enter(){ document.getElementById("gfg").innerHTML="Enter"; } function leave(){ document.getElementById("gfg").innerHTML = "Exit"; } </script> <p id="gfg" onmouseenter="enter()" onmouseleave="leave()"> Welcome to GFG </p> Output:  Comment More infoAdvertise with us Next Article JavaScript onmouse Events C chakradhar_chinni Follow Improve Article Tags : JavaScript Web Technologies JavaScript-Events Similar Reads JavaScript Events JavaScript Events are actions or occurrences that happen in the browser. They can be triggered by various user interactions or by the browser itself. HTML<html> <script> function myFun() { document.getElementById( "gfg").innerHTML = "GeeksforGeeks"; } </script> <body> <but 3 min read Pointer Events in Javascript DOM Pointer events are a set of DOM (Document Object Model) events that provide a unified way of handling inputs from a variety of devices, such as touchscreens, mouse, and pen/stylus. These events are supported by modern browsers and allow developers to write code that responds to user interactions wit 5 min read What are JavaScript Events ? JavaScript Events are the action that happens due to the interaction of the user through the browser with the help of any input field, button, or any other interactive element present in the browser. Events help us to create more dynamic and interactive web pages. Also, these events can be used by t 6 min read JavaScript Coordinates of Mouse In JavaScript, we have methods that help us to capture the location of the mouse on the screen. The top left corner of the screen is (0, 0) i,e, X, and Y coordinates are (0, 0). This means that vertical zero is the topmost point and horizontal zero is the leftmost point. In this article, we are goin 2 min read JavaScript contextmenu MouseEvent When we click the right mouse button on our desktop, a menu-like box appears and this box is called the context menu. In JavaScript, a context menu event runs when a user tries to open a context menu. This can be done by clicking the right mouse button. This article demonstrates executing any operat 1 min read Like