Code:
Copy codeThe Code is as follows:
Document. onkeydown = function ()
{
Var EventUtil = {};
EventUtil. getEvent = function (){
If (window. event) {return window. event ;}
Else {return EventUtil. getEvent. caller. arguments [0];}
}
Var button = document. getElementById ("qw ");
If (EventUtil. getEvent (). keyCode = 13)
{
Button. click ();
Event. returnValue = false;
}
}
For comparison: Uploading 1 does not support IE, but supports FireFox:
Copy codeThe Code is as follows:
Window. onkeydown = function ()
{
Var EventUtil = {};
EventUtil. getEvent = function (){
If (window. event) {return window. event ;}
Else {return EventUtil. getEvent. caller. arguments [0];}
}
// Bind a button event whose id is qw
Copy codeThe Code is as follows:
Var button = document. getElementById ("qw ");
If (EventUtil. getEvent (). keyCode = 13)
{
Button. click ();
Event. returnValue = false;
}
}
What are the differences?
The above is for reference only.