for the above textbox, I used the "onKeypress" function for the body
tag, name of my function is keyPress........
<BODY onKeyPress = "keyPress()">
I globalized one variable - that I will use in a few functions.
var inString = ""
Here's the code:
function keyPress()
{
inString += String.fromCharCode(window.event.keyCode)
document.form1.Textbox.value = inString
}
IE has a fromCharCode() method -- to get the actual letter, number or symbol of the key
window.event.keyCode - gets us what key was pressed, saves it in the string and just adds it to the textbox, automatically, updating on another keypress.
<input type=submit onClick="checkKey()">
Modifiers:
returns a value when a mouse or keypress event occurs.
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