把action定為本身的頁面

a.asp:
<%
'asp code
%>
<form action="a.asp" method="post" name="fm">
...
</form>
你是不是想這樣?

解决方案 »

  1.   

    那就是重新刷新本頁面了...直接reload就可以了!!!如果不放心,就像樓上一樣,action參數設置成本頁面路徑就可以了
      

  2.   

    <script language=java script>
    history.go(-1)
    </script>
      

  3.   

    谢谢回答,但各位的方法都不能阻止IE换页,只不过是IE换过后,再用代码换回来!
    我想只能用XmlHttp直接POST了!xmlHttp.open("POST", "xxxxxxx", false);......
      

  4.   

    用iframe试试
    test.htm
    --------------------------------------------------------------------------------
    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>New Page 1</title>
    <script>
    function submitdata()
    {
      var obj=window.frames("DFrm").document;
      obj.all("bh").value=tzid;
      obj.all("DFrm").submit();}
    </script>
    </head><body>
     <p><input type="text" name="bh" id="bh" size="20"><input type="submit" value="提交" name="B1" onclick="submitdata()"></p>
    <iframe name="DFrm" id="DFrm" src="test.asp" width=0 height=0></iframe>                                                                                                  </body></html>
    ---------------------------------------------------------------------------------
    test.asp
    ---------------------------------------------------------------------------------
    <% 
       数据处理
    %>
    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>New Page 1</title>
    </head>
    <body>
    <form method="POST" action="" name="DFrm" id="DFrm">
      <input type="text" name="bh" id="bh" size="13" class="input">
      <input type="hidden" name="result" value=100> 
      <input type="button" onclick="DFrm.submit();"> 
    </form>   </body></html>
      

  5.   

    iframe应该可以,但你的代码运行有错,说找不到all !
      

  6.   

    form的本质是请求server端运行某特定程序,所以要么重装载页面,要么就是表单发送的target设定成非本页(比如指向一个不可见的iframe)<html>
    <head></head>
    <body>
    <form target="actfrm" action="b.php">
    <input type="text" name="msg">
    </form>
    <iframe marginheight=0 marginwidth=0 frameborder=0 width=0 height=0 scrolling=no src="about:blank" name="actfrm">
    </body></html>
      

  7.   

    sorry,更正如下:
    ------------------------------------------------------------------------------
    <script>
    function submitdata()
    {
      var obj=window.frames("DFrm").document;
      obj.all("bh").value=document.all("bh").value;
      obj.all("SFrm").submit();}
    -----------------------------------------------------------------------------
    </script>