在同一页面处理提交代码

可用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>

    

原文地址:https://www.cnblogs.com/djcsch2001/p/2035763.html