循环增添事件

循环添加事件Function.prototype.bind function(){ // 自己定义的方法var oThis this, args Array.p

循环添加事件

Function.prototype.bind = function(){ // 自己定义的方法  var oThis = this, args = Array.prototype.slice.call(arguments), obj = args.shift();  return function (){  oThis.apply(obj, args);  }  }  function aa()   {     var radio = document.getElementsByName("attr");     for(var i=0;i  <radio.length;i++)     {  radio[i].onclick = bb.bind(radio[i],i);    }   }     function bb(i)   {     alert(i);   }  aa();