Javascript DOM HTML Input Text handle mouse down event
<!DOCTYPE html> <html> <body> <input type="text" size="40" onmousedown="myFunction(event)"> <p id="demo"></p> <script> function myFunction(event) {/*w ww . j a v a 2 s .c o m*/ var x = event.getModifierState("CapsLock"); document.getElementById("demo").innerHTML = "Caps Lock activated: " + x; } </script> </body> </html>