Javascript examples for DOM Event:onmousedown
The onmousedown event occurs when a user presses a mouse button over an element.
Bubbles | Yes |
---|---|
Cancelable | Yes |
Supported HTML tags: | All HTML elements, EXCEPT: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, and <title> |
<!DOCTYPE html> <html> <body> <p id="demo" onmousedown="mouseDown()" onmouseup="mouseUp()">Click me.</p> <script> function mouseDown() {//from w ww . ja va 2s . c om document.getElementById("demo").innerHTML = "The mouse button is held down."; } function mouseUp() { document.getElementById("demo").innerHTML = "You released the mouse button."; } </script> </body> </html>