Event: Events Object, when an event occurs, some detailed information about the event that occurs with the current object is temporarily saved to a specified place-event object, which we can call when needed.
the event object must be used inside a function called by an event to have content. Event function: A function called by an event, a function is not an event function, it is not determined at the time of definition, but depends on the time of the function call.
compatible with:Ie/choreme:event is a built-in global object. Standard Browser: The event object is passed in by the first parameter of the event function.
If a function is called by an event, then the first parameter defined by the function is the event object. Example code:
1 <!DOCTYPE HTML>2 <HTMLLang= "en">3 <Head>4 <title>Event Object</title>5 <MetaCharSet= "UTF-8">6 <Metaname= "Viewport"content= "Width=device-width, initial-scale=1">7 <Script>8 9 functionfn1 (EV) {Ten varEV=EV||event;//compatible wording One for(varattrinchev) { A Console.log (attr+ '=' +ev[attr]); //Traverse All Events - } - } the fn1 ();//function not called by event - Document.onclick=fn1;//is the function called by the event - - + </Script> - </Head> + <Body> A at </Body> - </HTML>
JS Learning Note----Event object