Tryit Editor v1.8

Source Code:
<!DOCTYPE html> <html> <head> <script> function isKeyPressed(event) { if (event.altKey==1) { alert("The ALT key was pressed!"); } else { alert("The ALT key was NOT pressed!"); } } </script> </head> <body onmousedown="isKeyPressed(event)"> <p>Click somewhere in the document. An alert box will tell you if you pressed the ALT key or not.</p> </body> </html>
Result:
W3Schools.com - Try it yourself