在同一页面处理提交代码

来源:互联网 发布:制作在线答题软件 编辑:程序博客网 时间:2024/05/16 06:41

可用Request.ServerVariables("Request_Method")="POST"判断是否提交,如下dice.asp页面

<html>

    <head><title>测试Request_Method</title></head>

    <body>

    <%

        Session("point")=6

        If Request.ServerVariables("Request_Method")="POST" then

    %>

    <form method="POST" action="dice.asp">

    <p>当色子的面数为<input type="text" name="T1" size="5" value=<%=session("point") %>>时</p>

    <p><input type="submit" value="掷色子" name="B1"></p>

    </form>

    <p>掷色子的结果为:5点</p>

    <%

        Else

    %>

    <form method="POST" action="dice.asp">

    <p>当色子的面数为<input type="text" name="T1" size="5" value=<%=session("point") %>>时</p>

    <p><input type="submit" value="掷色子" name="B1"></p>

    </form>

    <%

        end if

    %>

    </body>

</html>

    

原创粉丝点击