有问题问“yms123”老师
非常感谢yms123老师:但我就很郁闷,以下情况(红色部门)为什么实现不了??================================================
<html>
<head>
<title>奇数循环相加</title>
<script language="javascript">
//表单提交
function form1_Submit()
{
document.form1.action=self.location.href;//提交到当前页
document.form1.submit();//提交表单
}
</script>
<%
Dim i,Total,txtCount
Total=0
txtCount=Request.Form("txt_Num").Count
For i=1 To txtCount
IF CInt(Request.Form("txt_Num")(i)) Mod 2<>0 Then
Total=Total+CInt(Request.Form("txt_Num")(i))
End IF
Next
Response.Write "alert('奇数和为"&Total&"');"
%>
</head>
<form name="form1" method="post" >
<input type=text name=txt_Num1>
<input type=text name=txt_Num2>
<input type=text name=txt_Num3>
<input type=text name=txt_Num4>
<input type=text name=txt_Num5>
<input type='button' name='Submit' onClick='form1_Submit();' value="提交" />
</form>
</body>
</html>
==================================================================
为什么把红色部分改为以下代码就可以了?但我的代码是红色部分的代码,且不能更改为以下代码(因为此方式还有它用),请问老师,怎么办??感谢!
================================================================
<%
For t=0 To txtNum
Response.Write "<input type=text name=txt_Num /></br>"
Next
%>
================================================================
<input type=text name=txt_Num />
<input type=text name=txt_Num />
<input type=text name=txt_Num />
<input type=text name=txt_Num />
<input type=text name=txt_Num />
================================================================