<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Down Cursor Key Capture</title>
<script type="text/javascript">
<!--
this.focus();
// capture the DOM key events for the three different DOMs (IE,NS 4,DOM2)
// DOM 2 (modern browsers)
if (document.addEventListener)
document.addEventListener("keypress",checkKey,true);
// NS 4 (proprietary)
if (navigator.appName == "Netscape" && navigator.appVersion.indexOf("4.x") != -1)
document.captureEvents(Event.KEYPRESS);
// (IE proprietary)
document.onkeyup=checkKey;
// the function called on the DOM key events
function checkKey(e) {
// get the key code - 40 is the down cursor arrow
var tmp = (window.event) ? event.keyCode : e.keyCode;
if (tmp==40)
alert('Down Cursor Key Pressed');
}
//-->
</script>
</head>
<body>
Press the down cursor key.
</body>
</html>
© Coyright 2000-2008, Roderick (Rod) W. Divilbiss. Some rights reserved.
Except where otherwise noted, this site, all content, and all source code and markup is licensed under a Creative Commons License
Creative Commons License.
No part of this web site including all application code and examples may be used for commercial purposes without prior written permission from the author,
Roderick W. Divilbiss of Overland Park, Kansas, United States of America.