我想设计一个可以计算范围内任意两个数的求和程序。
但它没有运行,我找不到错误〜
<BODY>
<p align ="center"></p>
<form name = "form1" method ="post" action ="">
<p>enter the range</p>
lower limit<input name ="tlow" type= "text" id ="tlow" size ="10">higher limit
<input name ="thigh" type ="text" id ="thigh" size ="10">
<input type ="submit" name ="submit" value ="sum"
</form>
<%
Dim i, sum,low,high
sum=0
low=request("tlow")
high=request("thigh")
For i=low To high
sum= sum + i
Next
response.write"sum from "& low &"to" & high &"is:"& sum
%>
</BODY>
答案 0 :(得分:0)
你的问题有两个:
首先,您的输入名称属性分为两行。这可以防止页面在发布时知道名称。所以:
<input name ="
thigh" type ="text" id ="thigh" size ="10">
应该是
<input name ="thigh" type ="text" id ="thigh" size ="10">
其次,您需要在最后正确关闭<BODY>
代码:</BODY>