为什么要加return false;
<input type="submit" name="Submit" value="提  交" onclick="return del()" />
“提交”按钮是会提交的form的,而你只是单纯的页面跳转,return del();就是为了防止from的提交

解决方案 »

  1.   

    像上面所說的,你只是单纯的页面跳转,return del();就是为了防止from的提交
    如果非要用location.href,就在加上參數,如delzxxw.asp?text=xxx,否則就用form.action=delzxxw.asp,這時不能用return false。
      

  2.   

    这个是zxxwgl.asp 
    <form id="form" name="form" method="post" action="delzxxw.asp"> 
                  <table width="518" border="0" cellspacing="0"> 
                    <tr> 
                      <td width="320">请输入需要删除的新闻ID: 
                      <input name="text" type="text" size="10" maxlength="4" /> </td> 
                      <td width="194"> <input name="Submit" type="submit" id="Submit" value="提  交"/> </td> 
                    </tr> 
                  </table> 
    </form> 
    这个是delzxxw.asp 
    <!--#include file="conn.asp"--> 
    <%if session("name")="" then%> 
      <script> 
      alert("请先登陆!"); 
      window.location.href="admin.asp"; 
      </script> 
    <%else 
      if request.form("text")="" then%> 
      <script> 
      alert("不能为空!"); 
      window.location.href="zxxwgl.asp"; 
      </script> 
    <%else 
      sql="select * from zxxw" 
      set rs=server.createobject("adodb.recordset") 
      rs.open sql,conn,1,1 
      del="delete * from zxxw where id=clng('"&request.form("text")&"')" 
      conn.execute(del)%> 
      <script> 
      alert("新闻删除成功,按确定后返回!"); 
      window.location.href="zxxwgl.asp"; 
      </script> 
      <%set rs=nothing 
      conn.close 
      set conn=nothing%> 
    <%end if 
    end if 
    %> 
    我现在想按下提交按钮后首先弹出一个双选对话框,点击确定继续删除,点击取消就返回zxxwgl.asp,怎么实现呢
      

  3.   

    这个是zxxwgl.asp 
    <form id="form" name="form" method="post" action="delzxxw.asp"> 
                  <table width="518" border="0" cellspacing="0"> 
                    <tr> 
                      <td width="320">请输入需要删除的新闻ID: 
                      <input name="text" type="text" size="10" maxlength="4" /> </td> 
                      <td width="194"> <input name="Submit" type="submit" id="Submit" value="提  交"/> </td> 
                    </tr> 
                  </table> 
    </form> 
    这个是delzxxw.asp 
    <!--#include file="conn.asp"--> 
    <%if session("name")="" then%> 
      <script> 
      alert("请先登陆!"); 
      window.location.href="admin.asp"; 
      </script> 
    <%else 
      if request.form("text")="" then%> 
      <script> 
      alert("不能为空!"); 
      window.location.href="zxxwgl.asp"; 
      </script> 
    <%else 
      sql="select * from zxxw" 
      set rs=server.createobject("adodb.recordset") 
      rs.open sql,conn,1,1 
      del="delete * from zxxw where id=clng('"&request.form("text")&"')" 
      conn.execute(del)%> 
      <script> 
      alert("新闻删除成功,按确定后返回!"); 
      window.location.href="zxxwgl.asp"; 
      </script> 
      <%set rs=nothing 
      conn.close 
      set conn=nothing%> 
    <%end if 
    end if 
    %> 
    我现在想按下提交按钮后首先弹出一个双选对话框,点击确定继续删除,点击取消就返回zxxwgl.asp,怎么实现呢
      

  4.   

    <input type="submit" name="Submit" value="提  交" onclick="return confirm('確定刪除嗎?');" />