ASP高手请进(关于ASP加法问题)非常的急
2个回答
展开全部
偶不是高手,也不要钱,看看这个行么
lianxi.asp
<%
DIM A
DIM B
RANDOMIZE
A=INT(100*RND+1)
B=INT(100*RND+1)
%>
<HTML>
<TITLE>
加法练习
</TITLE>
<BODY>
<FORM METHOD="POST" ACTION="result.asp">
<%=A%> + <%=B%> = <INPUT TYPE="TEXT" NAME="RESULT"><BR>
<INPUT TYPE="HIDDEN" VALUE="<%=A%>" NAME="A">
<INPUT TYPE="HIDDEN" VALUE="<%=B%>" NAME="B">
<INPUT TYPE="SUBMIT" VALUE="确定">
</FORM>
</BODY>
</HTML>
result.asp
<HTML>
<TITLE>
结果
</TITLE>
<%
ON ERROR RESUME NEXT
DIM A
DIM B
A=CINT(REQUEST.FORM("A"))
B=CINT(REQUEST.FORM("B"))
Dim RES
IF REQUEST.FORM("RESULT") <> "" THEN
RES = CINT(REQUEST.FORM("RESULT"))
IF RES = A + B THEN
RESPONSE.WRITE("正确<BR>")
RESPONSE.WRITE(A&" + "&B&" = "&(A+B))
ELSE
RESPONSE.WRITE("错误<BR>")
RESPONSE.WRITE("应该为 "&A&" + "&B&" = "&(A+B))
END IF
ELSE
RESPONSE.WRITE("请输入数字")
END IF
%>
<FORM ACTION="lianxi.asp" METHOD="POST">
<INPUT TYPE="SUBMIT" VALUE="继续">
</FORM>
</HTML>
lianxi.asp
<%
DIM A
DIM B
RANDOMIZE
A=INT(100*RND+1)
B=INT(100*RND+1)
%>
<HTML>
<TITLE>
加法练习
</TITLE>
<BODY>
<FORM METHOD="POST" ACTION="result.asp">
<%=A%> + <%=B%> = <INPUT TYPE="TEXT" NAME="RESULT"><BR>
<INPUT TYPE="HIDDEN" VALUE="<%=A%>" NAME="A">
<INPUT TYPE="HIDDEN" VALUE="<%=B%>" NAME="B">
<INPUT TYPE="SUBMIT" VALUE="确定">
</FORM>
</BODY>
</HTML>
result.asp
<HTML>
<TITLE>
结果
</TITLE>
<%
ON ERROR RESUME NEXT
DIM A
DIM B
A=CINT(REQUEST.FORM("A"))
B=CINT(REQUEST.FORM("B"))
Dim RES
IF REQUEST.FORM("RESULT") <> "" THEN
RES = CINT(REQUEST.FORM("RESULT"))
IF RES = A + B THEN
RESPONSE.WRITE("正确<BR>")
RESPONSE.WRITE(A&" + "&B&" = "&(A+B))
ELSE
RESPONSE.WRITE("错误<BR>")
RESPONSE.WRITE("应该为 "&A&" + "&B&" = "&(A+B))
END IF
ELSE
RESPONSE.WRITE("请输入数字")
END IF
%>
<FORM ACTION="lianxi.asp" METHOD="POST">
<INPUT TYPE="SUBMIT" VALUE="继续">
</FORM>
</HTML>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询