The Event object represents the Event status, such as the elements in the Event, the status of the keyboard buttons, the location of the mouse, and the status of the mouse button. The method to obtain the Event object is as follows, if you are interested, refer
Introduction:
The Event object represents the Event status, such as the elements in the Event, the status of the keyboard buttons, the location of the mouse, and the status of the mouse button. Events are usually used in combination with functions. functions are not executed before an event occurs!
How to obtain the Event object:
Method 1:
For example:
The Code is as follows:
Function demo1 (e ){
Var e = e | window. event;
// This method can obtain the event either without passing the parameter e in ie or google, but the event parameter must be passed in the event Method in Firefox.
// To obtain the event object.
}
Method 2:Common and convenient methods (this method is convenient because parameters are not required)
For example:
The Code is as follows:
Function demo2 (){
Var e = arguments. callee. caller. arguments [0] | window. event;
// Arguments. callee indicates the current function body.
// Arguments. callee. caller is the upper-level function of the current function.
// When onclick = "demo2 ()" is executed, arguments. callee is demo2 (), arguments. callee. caller is function onclick,
// The first number of energy in onclick is event, that is, arguments. callee. caller. arguments [0.
}
Detailed Test summary:
I. The same omnipotent method is to pass the parameter event (the real parameter must be written with the event name but not the other name.
2. Windows. event is not supported by Firefox in ie and google browsers.
Iii. arguments. callee. caller. arguments [0] is only supported by Firefox and google. ie does not support this method.
From the above test results, we can see that google supports the above methods and is one of the most compatible browsers.