Caliban
10-30-2003, 10:46 AM
Hi y'all JS gurues :)
Is there a way to know what was the key pressed, in the "onkeypressed" event ????
TIA
Is there a way to know what was the key pressed, in the "onkeypressed" event ????
TIA
|
Click to See Complete Forum and Search --> : What is the key pressed in the "onkeypressed" event ???? Caliban 10-30-2003, 10:46 AM Hi y'all JS gurues :) Is there a way to know what was the key pressed, in the "onkeypressed" event ???? TIA gil davis 10-30-2003, 11:01 AM In IE: event.keyCode. In Netscape: event.which. if(document.layers) document.captureEvents(Event.KEYPRESS); document.onkeypress = myKeyPress; function myKeyPress(evt) { if(document.all) {alert(event.keyCode);} else {alert(evt.which + ", " + evt.modifiers); return false; } It is a real pain to get modifiers in IE. Each modifier is a boolean in the event. See http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_event.asp for details. webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |