Say you attach several listeners to an event, for example you want a few things to happen on page load. What is the order of execution of the different listeners? You’d think that the listener attached first will execute first, followed by the second and so on… Well, yes, in FF, Opera, Safari on Windows, but not in IE.
假设您将多个侦听器附加到一个事件,例如,您希望在页面加载时发生一些事情。 不同的侦听器的执行顺序是什么? 您可能会认为,首先连接的侦听器将首先执行,然后执行第二个,依此类推…好吧,是的,在Windows上的FF,Opera,Safari中,但在IE中则没有。
考试
(
The test
)
var i = 1, ol = document.getElementById('result');
for (i; i <= 10; i++) {
YAHOO.util.Event.addListener(window,'load',
function(num){
return function(){
ol.innerHTML += '