Javascript DOM HTML Body handle mouse down event
<!DOCTYPE html> <html> <body onmousedown="isKeyPressed(event)"> <p id="demo"></p> <script> function isKeyPressed(event) {//from ww w. j ava 2s.c o m if (event.ctrlKey) { document.getElementById("demo").innerHTML = "The CTRL key was pressed!"; } else { document.getElementById("demo").innerHTML = "The CTRL key was NOT pressed!"; } } </script> </body> </html>