function addEvent(el ,type ,fn){
if(el.addEventListener){
el.addEventListener(type,fn,false);
}else if(el.attachEvent){
el.attachEvent('on'+type,fn);
}else{
el['on'+type] = fn;
}
} function alertIndex(){
alert(2);
}
addEvent(ipt[0],'click',function(){
alert(1)
});
addEvent(ipt[0],'click',alertIndex);