如果我必须调用 javascript 函数(例如,ProcessingOne 和 ProcessingTwo),并且我将它们与按钮的 onclick 事件相关联:
- 一个链接到文档就绪调用中按钮的 onclick
-另一个是直接在按钮的html中输入
单击按钮时会先触发哪个?
(好吧,我可以在 5 分钟内测试一下,但我想知道浏览器处理此问题的标准方式是什么)
最佳答案
来自DOM Level 2 (Events) Specification :
Although all EventListeners on the EventTarget are guaranteed to be triggered by any event which is received by that EventTarget, no specification is made as to the order in which they will receive the event with regards to the other EventListeners on the EventTarget.
关于javascript - 首先会调用哪个 JavaScript 方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8007607/