Javascript DOM Mouse Down Event
<!DOCTYPE html> <html lang="en"> <body> <form action="" name="form1"> <input type="button" name="myButton" value="Mouse goes up" /> </form> <script> let myButton = document.form1.myButton; function myButtonMouseup() { myButton.value = "Mouse Goes Up"; } /*www . j a va 2s. co m*/ function myButtonMousedown() { myButton.value = "Mouse Goes Down"; } myButton.addEventListener("mousedown", myButtonMousedown); myButton.addEventListener("mouseup", myButtonMouseup); </script> </body> </html>