Event.Keys fix test
Checking which keys create problems with event keys
by ariehg
HTML
<ul id='res'></ul>
JavaScript
Event.Keys = {
'enter': 13,
'up': 38,
'down': 40,
'left': 37,
'right': 39,
'esc': 27,
'space': 32,
'backspace': 8,
'tab': 9,
'delete': 46,
'shift' : 16,
'control' : 17,
'alt' : 18,
'`' : 192,
'-' : 109,
'=' : 107,
',' : 188,
'.' : 190,
'/' : 191,
';' : 59,
'\'' : 222,
'[' : 219,
']' : 221,
'\\' : 220,
'*' : 106,
'f1' : 112,
'f2' : 113,
'f3' : 114,
'f4' : 115,
'f5' : 116,
'f6' : 117,
'f7' : 118,
'f8' : 119,
'f9' : 120,
'f10' : 121,
'f11' : 122,
'f12' : 123
};
var current_key = '', res = $('res');
function down(e){
current_key = e.key;
}
function press(e){
if (current_key==e.key)
res.adopt(
new Element('li',{html:'no prob!:'+e.key})
);
else{
res.adopt(
new Element('li',{
html:'problem! keydown:'+current_key+' |press:'+e.key
})
);
}
e.stop();
return false;
}
document.addEvents({'keydown':down,'keypress':press});