<スクリプト>
function addObjectEvent(objId,eventName,eventFunc)
{
var targetObj = document.getElementById(objId);
if(targetObj)
{
if(targetObj.attachEvent)
{
targetObj.attachEvent(eventName,eventFunc);
}
else if(targetObj.addEventListener)
{
eventName =eventName.toString().replace(/on(.*)/i,'$1');
targetObj.addEventListener(eventName,eventFunc,true);
}
}
}
function test1()
{
alert('test1');
}
関数 test2()
{
alert('test2');
}
on click
addObjectEvent('hi','onclick',test1);
addObjectEvent('hi','onclick',test2);//先执実行test2(队列)