2

我想设计一个求和程序,可以计算范围内的任意两个数字。

但是没有运行,找不到错误~

<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>
4

1 回答 1

0

你的问题是双重的:

首先,您的输入名称属性跨越两行。这可以防止页面在发布时知道名称。所以:

 <input  name ="
 thigh" type ="text" id ="thigh" size ="10">

应该

 <input  name ="thigh" type ="text" id ="thigh" size ="10">

其次,您需要<BODY>在最后正确关闭标签:</BODY>

于 2012-08-21T12:32:00.290 回答