![]() |
| 编程社区 » asp编程 » 帮忙看看实现如下功能 |
帮忙看看实现如下功能 |
yidaisy |
发表:
|
像作业题。。。。mark一下,
if 有空了 and 答案没出来 then
我做一下
else
我看一下
end if
<%
if session("mark")="" or request.QueryString("restart")="true" then
session("mark")=0
end if
if session("page")="" or request.QueryString("restart")="true" then
session("page")=0
end if
dim Page
Page=request.QueryString("page")
if Page="" or not isnumeric(Page) then
Page=1
end if
Page=cint(Page)
if Page=11 then
response.Write("<br /><br />回答完毕!您的得分为:" & session("mark") & "<br /><br /><a href='?restart=true'>再来</a>")
session("mark")=""
response.End()
end if
if request.ServerVariables("CONTENT_LENGTH")>0 then
if session("page")=Page then
response.Redirect("?page=" & Page+1)
end if
session("page")=Page
dim result
result=trim(request.Form("result"))
if result="" or not isnumeric(result) then
result=-1
end if
result=cint(result)
if result=cint(request.Form("i1")) + cint(request.Form("i2")) then
session("mark")=session("mark")+10
response.Write("回答正确!您现在的分数是:" & session("mark") & "<br /><br /><a href='?page=" & Page+1 & "'>下一题</a>")
response.End()
else
response.Write("回答错误!正确答案为:" & cint(request.Form("i1"))+cint(request.Form("i2")) & "<br /><br /><a href='?page=" & Page+1 & "'>下一题</a>")
response.End()
end if
end if
randomize
i1=cint(rnd() * 100)
i2=cint(rnd() * 100)
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<input name="i1" type="text" readonly="true" value="<%=i1%>" size="3" />
+
<input name="i2" type="text" readonly="true" value="<%=i2%>" size="3" />
=
<input name="result" type="text" size="3" />
<input type="submit" name="Submit" value="提交" />
</form>
</body>
</html>
这个很简单呀,只要在生成时用一个变量储存它们的和就可以了,在用户输入后进行对比
需要用asp么?
JS就可以搞定哈~而且不用刷新!
他说要asp的嘛~~~
| 编程社区 2008 浙ICP备09013498号 |
| © TinyBBS.cn |
| 编程好站连接:codeproject sf.net codeplex |