Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body onmousedown="isKeyPressed(event)"> <p>Click somewhere in the document. An alert box will tell you if the CTRL key was pressed when the onmousedown event occured.</p> <p><strong>Tip:</strong> Try to press and hold down the CTRL key (on your keyboard) before you click in the document.</p> <script> function isKeyPressed(event) { if (event.ctrlKey) { alert("The CTRL key was pressed!"); } else { alert("The CTRL key was NOT pressed!"); } } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_event_mouse_ctrlkey by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:30:38 GMT --> </html>
Result:
Try it Yourself - © w3schools.com