:: StoryTitle Chapbook: Keyboard :: UserScript[script] (function () { document.addEventListener('keyup', function (ev) { /* the ev variable contains a keyup event object. * * ev.keyCode - contains the ASCII code of the key that was released, this property is supported in effectively all browsers. * ev.key - contains the key value of the key that was released, this property is supported by most modern browsers. * */ /* the following shows an alert when the 'a' key is released. */ if (ev.key === 'a') { alert("the 'a' key was released."); } }); }()); :: Start Press and release the ''a'' key to show an Alert dialog.