Questions tagged «attachevent»

2
正确使用addEventListener()/ attachEvent()吗?
我不知道如何使用addEventListener分别attachEvent正确? window.onload = function (myFunc1) { /* do something */ } function myFunc2() { /* do something */ } if (window.addEventListener) { window.addEventListener('load', myFunc2, false); } else if (window.attachEvent) { window.attachEvent('onload', myFunc2); } // ... 要么 function myFunc1() { /* do something */ } if (window.addEventListener) { window.addEventListener('load', myFunc1, false); …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.