Javascript examples for DOM Event:onmousedown
A function with parameters is triggered when the mouse button is pressed down
<!DOCTYPE html> <html> <body> <p onmousedown="myFunction(this,'red')" onmouseup="myFunction(this,'green')"> Click the text to change the color. </p>//from w w w. j a va 2s. c om <script> function myFunction(elmnt,clr) { elmnt.style.color = clr; } </script> </body> </html>