<%
a=cint(request.form("a"))
b=cint(request.form("b"))
select case true
case "+"
c=a+b
case "-"
c=a-b
case "/"
c=a/b
case "*"
c=a*b
end select
response.write(a&request.form("select")&b&"="&c)
%>
<body>
<form name="form1" id="form1" method="post" action="">
<p>
<input name="a" type="text" id="a" size="5">
<select name="select">
<option selected>+</option>
<option>-</option>
<option>*</option>
<option>/</option>
</select>
<input name="b" type="text" id="b" size="5">
</p>
<p>
<input type="submit" name="Submit" value="提交">
</p>
</form>
參考答案:错误出现在
select case true
case "+"
c=a+b
…………
end select
语句中应该是:
select case request.form("select")
修改后代码为:
<%
a=cint(request.form("a"))
b=cint(request.form("b"))
select case request.Form("select")
case "+"
c=a+b
case "-"
c=a-b
case "/"
c=a/b
case "*"
c=a*b
end select
response.write(a&request.form("select")&b&"="&c)
%>
<body>
<form name="form1" id="form1" method="post" action="">
<p>
<input name="a" type="text" id="a" size="5">
<select name="select">
<option selected>+</option>
<option>-</option>
<option>*</option>
<option>/</option>
</select>
<input name="b" type="text" id="b" size="5">
</p>
<p>
<input type="submit" name="Submit" value="提交">
</p>
</form>