Entry
How I can use Arrow key to move to next or previous fields in a form instead of using Tab key
May 21st, 2001 05:28
Colin Fraser, Alok Mishra,
Try this to capture the key presses and get the values of the actual key
presses. From there the answer becomes obvious.
<script><!--//
function netscapeKeyPress()
if (e.modifiers == 0) {
alert("Key that was pressed has an ASCII-value of: " +
e.which);
}
if (navigator.appName == 'Netscape') {
window.captureEvents(Event.KEYPRESS);
window.onKeyPress = netscapeKeyPress;
}
//and for IE it reads
function microsoftKeyPress() {
var pressed=(window.event.keyCode)
alert("Key that was pressed has an ASCII-value of: " + pressed);
}
//-->
</script>
<body onKeyPress="microsoftKeyPress()">
This should all work to produce the codes you require for all keystrokes
that do not use shift or ctrl keys, they are handled differently. You
are in for a surprise though.