You are here: irt.org | About | Feedback | 2222 [ previous next ]
Feedback on:
irt.org FAQ Knowledge Base Q848
Sent by
Trevor Hastings on January 09, 2001 at 21:26:22:
Technical:
Not technical enough
Comments:
Hi folks,
I love the irt knowledge base, but the answer for Q848 needs work.
Right now it says "In Netscape key presses are only captured when the cursor is within a text field."
That might have been true in some earlier version of Netscape, but all version 4, 5, and 6 browsers can capture key presses without any text field. (The catch is that the cursor can't be up in the "Location" box at the top of the screen.)
I'm including a script to show what I mean. I hope it helps!
- Trevor Hastings
------------------
<HTML>
<HEAD>
<TITLE>Untitled</TITLE>
<SCRIPT LANGUAGE="Javascript">
if (document.layers) {
document.captureEvents(Event.KEYPRESS)
}
document.onKeyPress = getKeyValue;
function getKeyValue(e){
if (document.all) {
var whichCode =
event.which ? event.which :
event.charCode ? event.charCode :
event.keyCode;
}
else {
var whichCode =
e.which ? e.which :
e.charCode ? e.charCode :
e.keyCode;
}
alert ("Key value is: " + whichCode)
}
</SCRIPT>
</HEAD>
<BODY onKeyPress="getKeyValue(event)">
This is a test. Hit any key to get its value.
</BODY>
</HTML>
Other feedback on 'irt.org FAQ Knowledge Base Q848' - show all