for(var i=0;i <input.length;i++){ 
      input[i].onblur=某个函数名; 
}
这样应该就可以了吧

解决方案 »

  1.   

    上面的方法添加事件后会移除对象之前已经存在的事件,可以用下面的方法来解决:if(obj.attachEvent) {
    obj.attachEvent("onchange",function() {//IE
    otherfunction(params);//这里可以给其实方法传参,也可以直接调用其它方法
    });
    } else if(obj.addEventListener) {//FF
    obj.addEventListener("change",function() {
    otherfunction(params);
    },false);
    }
      

  2.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
      <title> new document </title>
      <script type="text/javascript">
      <!--
    function addEventHandler(){
    var oInput = document.getElementsByTagName("input");
    for(var i = 0; i < oInput.length; i++ ){
    if(oInput[i].type == "text"){
    oInput[i].onblur = function(){
    alert("Success Blur")
    }
    }
    }
    }
      //-->
      </script>
     </head> <body>
    <input type="text" id="" /><br/>
    <input type="text" id="" /><br/>
    <input type="text" id="" /><br/>
    <input type="text" id="" /><br/>
    <input type="text" id="" /><br/>
    <input type="button" value="添加事件" onclick="addEventHandler()" />
      
     </body>
    </html>