W3C home > Mailing lists > Public > public-html-ig-zh@w3.org > October 2010

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

From: Zi Bin Cheah <zibin@opera.com>
Date: Fri, 22 Oct 2010 13:32:27 +0200
Cc: 中文HTML5同樂會ML <public-html-ig-zh@w3.org>
Message-Id: <8A242606-8C42-4C92-A848-AEF6B65DA230@opera.com>
To: OOO <othree@gmail.com>


> 現在有 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

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:43:46 UTC