Type something...


Gotta go get our event handler for netscape and tell it what function to look for
document.onKeyPress = keyPress

var inString = ""

Gotta send it the event "e" - that's just how netscape works - it is looking for that event handler - "e"

function keyPress(e)
{
var keyCode = new Number(e.which)
inString += unescape("%" + keyCode.toString(16))
document.form1.Textbox.value = inString
}
For the function, netscape gets goofy:

keyCode - new Number(e.which) -- means whatever value is arriving with that "e" object we sent in, make it a number

inString += unescape("%" + keyCode.toString(16)) --

this one means add to our string - our variable keyCode - turned into a string (base 16 for ascii) -- don't think about it, just know where to get it if you ever need it.



function checkKey(e)
{
if (window.keycode != 27) {
alert("Your return key has been disabled");
return false
}
}

This one is simple enough, except that the key codes are not the same,you should check them if you ever need them


Same Modifiers:

alt = 1
control = 2
alt + control = 3
shift = 4
alt + shift = 5
control + shift = 6<
alt + control + shift = 7

apple keys

meta = 8
meta + alt = 9
meta + control = 10
meta + alt + control = 11
meta + shift = 12
meta + alt + shift = 13
meta control + shift = 14
meta + alt + control + shift = 15

For nescape to capture events on "myLayer" :

document.myLayer.document.captureEvents(Event.Click) (no double-click for Apple)

 

suppose:

 

<html>

<body>

<form> <input type = "button" onMouseDown="keytest2(event);"></form>
<javascript>

document.onclick = keytest2
document.onkeypress = keytest2


function keyTest2(e){
if (e.modifiers == Event.Alt_Mask) {
if (e.which){
alert("Your document also had the: " + String.fromCharCode(e.which) + "\r\r" + key pressed with the ASCII value of : " + e.which)
}
}
return true;
}

and you pressed "t" uhhh, what do you get?

 



If you have a the "t" keyup event:
e.which = 20 because that's the ascii integer value for "t"