|
Q1593 In the 'onKeyDown' or 'OnKeyPress' event handlers is there a way to retrieve a window's handle given the window's name?
irt.org | Knowledge Base | JavaScript | Event | Q1593 [ previous next ]
Q1593 In the 'onKeyDown' or 'OnKeyPress' event handlers is there a way to retrieve a window's handle given the window's name?
Try:
<script language="JavaScript"><!--
var NS = (document.layers) ? 1 : 0;
var IE = (document.all) ? 1 : 0;
// if (NS) document.captureEvents(Event.KEYPRESS); // uncomment if you wish to cancel the key
document.onkeypress = keyhandler;
function keyhandler(e) {
if (NS) Key = e.which;
else Key = window.event.keyCode;
if (Key !=0) alert("Key pressed! ASCII-value: " + Key);
}
//--></script>
|
|
|
Copyright © 1996-2008 irt.org, All Rights Reserved.