return false;
}else{
inputs[i].style.backgroundColor="green";
}
}
}
var textareas=document.getElementsByTagName("textarea");
for(var i=0;i<textareas.length;i++){
if(isOnlySpace(textareas[i].value)){
textareas[i].style.backgroundColor="red";
return false;
}else{
textareas[i].style.backgroundColor="green";
}
}
var selects=document.getElementsByTagName("select");
for(var i=0;i<selects.length;i++){
if(selects[i].selectedIndex==0){
selects[i].style.backgroundColor="red";
return false;
}else{
selects[i].style.backgroundColor="green";
}
}
return true;
}
</script>
</head>
<body>
<input type="text">
<textarea></textarea>
<textarea></textarea>
<textarea></textarea>
<input type="text">
<input type="text">
<select>
<option>请选择</option>
<option>1</option>
</select>
<input type="button" onclick="notNullCheck()" value="notnullcheck">
</body>
</html>
大体这样试试
上一页 [1] [2]