[Script] Abstract the keyCode on Firefox
To abstract the key value which users press on their keyboard, IE supports a method to approach this goal.
onkeypress="window.event.keyCode";
But FireFox does not support window.event. For cross-platform, We have to revise this method.
onkeypress="jsGetKeyCode(event)"
...
jsGetKeyCode(e){
var keyCode = window.event ? e.keyCode : e.which;
}
onkeypress="window.event.keyCode";
But FireFox does not support window.event. For cross-platform, We have to revise this method.
onkeypress="jsGetKeyCode(event)"
...
jsGetKeyCode(e){
var keyCode = window.event ? e.keyCode : e.which;
}


0 Comments:
Post a Comment
<< Home