Re: 讨论一下讨厌的script标签

> 現在有 DOMContentLoaded 事件

onEventListener的model比DOM0的onEvent好,不过还是要面对 
IEhack (attachlistener)

>>>
>>>
>>> body.onElementLoad=function(element) {
>>>     if(element.id=="content"){
>>>         //do something
>>>     }
>>>



如果我要do many things,就麻烦了

body.onEvent = function1(){.....}
body.onEvent = function2(){.....}
body.onEvent = function3(){.....}

function3会取代function2会取代function1

而eventlistener不会有这个问题

addEventlistener(event,function1(), false)
addEventlistener(event,function2(), false)
addEventlistener(event,function3(), false)

不过PPK提过以上function1,2,3可能不会依次序实现。

Received on Friday, 22 October 2010 11:32:31 UTC