提交时的判断函数有问题
页面有5行,提交时判断填写的行是否填写完整。
<table>
<form method ="POST" name="frm" action="qcye3.asp" onsubmit=" return check()">
<%for i=0 to 4 %>
<tr>
<td>
<input type="text" name="a<%=i%>"></td>
<td>
<input type="text" name="b<%=i%>"></td>
</tr>
<% next%>
<tr>
<td colspan=3>
<p align="center">
<input type="submit" value="保存"></td>
</tr>
</table>
<script language="javaScript">
function check()
{
var s;
s=0;
for(var i = 0; i<5; i++)
{ if( (document.frm["a" + i].value!="") && (document.frm["b" + i].value!=""))
{ s++;
if( (document.frm["a" + (i+1)].value=="") || (document.frm["b" + (i+1)].value=="") )
{ alert('信息不完整!');
return false;
}
}
}
//alert(s);
}
</script>