//下边这个代码也许可以实现。我想楼主的意思是在一行中判断吧?不应该是要么全填要么去不吧?另外这个代买里边要求数组长度大于一。等于一的时候要另外考虑!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html>
<head>
<title>Untitled</title>
<Script language="javascript">
<!--
function fncCheck(){
var intCount=0;
var objForm=document.form1;
for (intCount=0;intCount<objForm.txtNM.length;intCount++){
if (objForm.txtNM[intCount].value!=""||objForm.txtSEX[intCount].value!=""||objForm.txtAGE[intCount].value!=""){
if (objForm.txtNM[intCount].value==""||objForm.txtSEX[intCount].value==""||objForm.txtAGE[intCount].value==""){
alert("error!");
}
} }
}
//-->
</Script>
</head><body>
<form name="form1">
<center>
<table>
<tr>
<td><input type="text" name="txtNM" value=""></td>
<td><input type="text" name="txtSEX" value=""></td>
<td><input type="text" name="txtAGE" value=""></td>
</tr>
<tr>
<td><input type="text" name="txtNM" value=""></td>
<td><input type="text" name="txtSEX" value=""></td>
<td><input type="text" name="txtAGE" value=""></td>
</tr>
</table>
<input type="button" name="btnCheck" value="CHECK" onClick="fncCheck()">
</center>
</form>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html>
<head>
<title>Untitled</title>
<Script language="javascript">
<!--
function fncCheck(){
var intCount=0;
var objForm=document.form1;
for (intCount=0;intCount<objForm.txtNM.length;intCount++){
if (objForm.txtNM[intCount].value!=""||objForm.txtSEX[intCount].value!=""||objForm.txtAGE[intCount].value!=""){
if (objForm.txtNM[intCount].value==""||objForm.txtSEX[intCount].value==""||objForm.txtAGE[intCount].value==""){
alert("error!");
}
} }
}
//-->
</Script>
</head><body>
<form name="form1">
<center>
<table>
<tr>
<td><input type="text" name="txtNM" value=""></td>
<td><input type="text" name="txtSEX" value=""></td>
<td><input type="text" name="txtAGE" value=""></td>
</tr>
<tr>
<td><input type="text" name="txtNM" value=""></td>
<td><input type="text" name="txtSEX" value=""></td>
<td><input type="text" name="txtAGE" value=""></td>
</tr>
</table>
<input type="button" name="btnCheck" value="CHECK" onClick="fncCheck()">
</center>
</form>
</body>
</html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货