错误的写法:
function checkInputF(){
this.style.border='1px #009bdd solid';}
var checkInput = document.getElementsByTagName("input");
for (var i=0; i<checkInput.length; i++){
checkInput[i].onfocus = checkInputF();
}
正确的写法:把for里面的绑定时间函数的()去掉;
for (var i=0; i<checkInput.length; i++){
checkInput[i].onfocus = checkInputF;
}
为什么呢?为什么呢?百度了“