if (typeof target.addEventListener != "undefined")
{
target.addEventListener(eventType, functionRef, capture);
}
else if (typeof target.attachEvent != "undefined")
{
target.attachEvent("on" + eventType, functionRef);
}
ie 和ff
{
target.addEventListener(eventType, functionRef, capture);
}
else if (typeof target.attachEvent != "undefined")
{
target.attachEvent("on" + eventType, functionRef);
}
ie 和ff
{
if(id.addEventListener){
id.addEventListener(type,fun,false);
}else if(id.attachEvent){
id.attachEvent(type,fun);
}else{
id[type] = fun;
}
}
那用那个?
IE要写成:
wy_Event(id,"onclick",function () {...})
而Firefox则要写成:
wy_Event(id,"click",function (e) {...})