<script> function a(){ alert("a"); } function b(){ alert("b"); } var arr = []; function addEvent(o,f){ o.blur=f(); var n = arr.length; while(n--){ if(arr[n]==f) return; } arr.push(f); } function Run(){ for(var i=0;i<arr.length;i++){ arr[i](); } } </script> <input type="text" value="123" onblur="addEvent(this,a)" /> <input type="text" value="456" onblur="addEvent(this,b)" /> <input type="button" value="T" onclick="Run()" />
时间: 2024-10-10 23:19:08