
|
| Keyboard Events
onKeydown="eHandle();" onKeyup="eHandle('keyup');">
Again, for reference, I have included the eHandle function-
function eHandle(et){
This does three things as far as keyboard variables go - when a key is pressed, the numerical value relating to that key is stored in the keyB variable.eType=et; mouseX=event.clientX+document.body.scrollLeft; mouseY=event.clientY+document.body.scrollTop; mButs=event.button; wheel+=event.wheelDelta/120; var ky=event.keyCode; keyB=ky keys[ky]=1; switch(eType){ case "mouseup": mButs=0; break; case "keyup": keyB=0; keys[ky]=0; break; } } Also, the keys array value at the address of that value is changed to 1. When a key is released, the keyB variable is given the value 0. Also, the keys array value at the address of that value is changed to 0. Remember, the keyB variable can be used with the keys array to find a text value-
var keys=new Array("None pressed","","","","","","","","Backspace","Tab",""
I have placed no more than ten values on any line for clarity. The largest number produced by a standard keyboard is 223, but there are fewer than 110 keys. This is why many of the entries in the array are empty. The template will feature the array on a single line.,"","","Enter","","","Shift","Control","Alt","Pause/Break","Caps Lock" ,"","","","","","","Esc","","","" ,"","Space Bar","Page Up","Page Down","End","Home","Left","Up","Right","Down" ,"","","","","Insert","Delete","","0","1","2" ,"3","4","5","6","7","8","9","","","" ,"","","","","A","B","C","D","E","F" ,"G","H","I","J","K","L","M","N","O","P" ,"Q","R","S","T","U","V","W","X","Y","Z" ,"Windows","","Menu","","","0","1","2","3","4" ,"5","6","7","8","9","*","+","","-","." ,"/","F1","F2","F3","F4","F5","F6","F7","F8","F9" ,"F10","F11","F12","","","","","","","" ,"","","","","","","","","","" ,"","","","Num Lock","Scroll Lock","","","","","" ,"","","","","","","","","","" ,"","","","","","","","","","" ,"","","","","","","","","","" ,"","","","","",";","=",",","-","." ,"","\'","","","","","","","","" ,"","","","","","","","","","" ,"","","","","","","","","[","\\" ,"]","#","¬"); As with the mouse, I have provided a keyboard tester- |