<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
action=request("action")
dim sum,znum
sum=cint(request("shu"))
if action="Sub" then
if not isNumeric(sum) then
response.Write("请输入数字<a href='javascript:history.back(-1)'>返回</a>")
response.End()
end if
if len(sum)>1 then
response.Write("请输入1-9的数字<a href='javascript:history.back(-1)'>返回</a>")
response.End()
end if
Randomize timer
znum = cint(8*Rnd+1)
if znum=sum then
response.Write "恭喜你,你猜对了。<br>"
else
response.Write "不好意思,你没猜对。<br>"
end if
response.Write"每次产生的随机数为:<font color=red>"&znum&"</font>"
end if
%>
<form name="form1" method="post" action="?action=Sub">
请输入1-9的数字<input name="shu" type="text" size="10">
<input type="submit" name="Submit" value="提交">
</form>
<html><head>
<meta http-equiv="Content-Type" content="text/htmlcharset=gb2312" />
<title>猜数字游戏</title>
</head>
<%
dim acc
dim suiji
dim shuzi
dim tishi
dim cishu
session("cishu")=session("cishu")+1acc=request("ac")
if acc=2 then
Randomize
session("cishu")=0
session("suiji")=int(100*rnd())
end if %>
<%
if acc=1 then
shuzii=int(request("shuzi"))
if session("suiji")=shuzii then
tishi="恭喜你猜对了"
else
if session("suiji")>shuzii then
tishi="你猜小了"
else
tishi="你猜大了"
end if
end if
end if
%>
<body>
<form id="form1" name="form1" method="post" action="csz.asp?ac=1">
<p>猜数字游戏请输入1-100之间的数</p>
<p>
<label>
<input type="text" name="shuzi" />
</label>
</p>
<p>
<label>
<input type="submit" name="Submit" value="提交" />
</label>
</p>
</form>
<p>你共猜了<%=session("cishu")%>次,提示:<%=tishi%></p>
<form name="form2" method="post" action="csz.asp?ac=2">
<label>
<input type="submit" name="Submit2" value="重新来过">
</label>
</form>
</body>
</html>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)