Calculator

80酷酷网    80kuku.com

  <html>
<title>
计算器
</title>
<body>
<form action=calculator.asp method=post>
操作数1: <input type=text name=num1>

操作数2: <input type=text name=num2>

<p>
选择你要进行的操作

<input type=radio name=operation value="加" checked>加

<input type=radio name=operation value="减">减

<input type=radio name=operation value="乘">乘

<input type=radio name=operation value="除">除

<input type=submit><input type=reset>
</form>
<hr>
<%
dim n1,n2,op
if request.form.count=0 then
response.end
end if
n1=request.form("num1")
n2=request.form("num2")
op=request.form("operation")
if op="加" then
response.write n1
response.write "+"
response.write n2
response.write "="
response.write clng(n1)+clng(n2)
elseif op="减" then
response.write n1
response.write "-"
response.write n2
response.write "="
response.write clng(n1)-clng(n2)
elseif op="乘" then
response.write n1
response.write "*"
response.write n2
response.write "="
response.write clng(n1)*clng(n2)
elseif op="除" then
response.write n1
response.write "/"
response.write n2
response.write "="
response.write clng(n1)/clng(n2)
end if
%>
</body>

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: