Domreay: Before the DOM tree is created, all the added Callbacks are stored in a queue. After the DOM tree is created, execute them one by one.
Onload (using multiple cast events), before page resources are loaded, all the added Callbacks are stored in a queue. After the resources are loaded, execute them in sequence. Since each page only has one onload, the callback after the page is loaded will not be executed.
Window. addeventlistner ("click", function () {alert (1)}, false); window. addeventlistner ("click", function () {alert (2)}, false); window. addeventlistner ("click", function () {alert (2)}, false); setTimeout (function () {window. addeventlistner ("click", function () {alert (4) // If. after onload is added, it will not be executed !}, False) ;}, 30000)
For common events, such as onclick (Multiple-vote events are used), the events in the queue are executed every time.
Ajax callback. Because Ajax generates a new XMLHTTPRequest object, the number of callbacks bound to this object is then destroyed.
Note that the execution of each event does not affect the next event.