1. There are three event models: the original event model (supported by all browsers), the DOM2 (supported by browsers except IE), the event model, the IE event model, and the Netscape event model.
--------------------------------------------------------------------------------------------------------------- --------------------------------
2. Detailed model
(1) Original event model
Divided into: Semantic event onclick and input event onsubmit
-------------------------------------------------------------------------
(2) DOM2 event model
It is generally divided into three steps: 1) The document is first propagated to the target object called the capture phase; 2) The event handler of the target object runs, and 3) bubbles from the target object to the document. Event.stoppropagation () can stop propagation, Preventdefault can block the default action of an event
AddEventListener ("EventType", "handler", "true!false"); //true, called at the stage of snapping; false, in the latter two stages;
Removeeventlistner ("EventType", "handler", "True!false");
Event compositing
1) Create the appropriate event object:
var e=document.createevent ("Htmlevents");
2) Initialize Event object domain (ie: attribute)
E.initevent ("Click", "true", "true");
3) Assign the event object:
Eventtarget.dispatchevent ();
-------------------------------------------------------------------------
(3) IE Event Model
IE Event object also has, but only a property of window, the target element's handler function--〉document, can only capture mouse events; event handlers are added and removed by: attachevent ("Eventty PE "," Handler ") and DetachEvent (" EventType "," handler ");
Indow.ecent.cancelbubble=true;
Event Registration functions: attachevent () and anti-registration: DetachEvent ().
-------------------------------------------------------------------------
(4) Netscape Event Model
--------------------------------------------------------------------------------------------------------------- --------------------------------
3.
201510091346_ "JavaScript event model--createevent, Initevent, dispatchevent"