有没有办法实现在按提交按钮后,弹出一个提示信息(页面或对话框...都可以),在弹出提示信息的同时也提交?

解决方案 »

  1.   

    <style>
    .msg{
    border:1px solid #888;
    background:#f7f7f7;
    width:300px;
    heght:50px;
    line-height:50px;
    position:absolute;
    z-index:99;
    text-align:center;
    }
    </style>
    <script type="text/javascript">function showMsg(msg){
    var div = document.getElementById("divMsg");
    if(div==null){
    div = document.createElement("div");
    div.className="msg";
    document.body.appendChild(div);
    }
    div.innerHTML=msg;
    div.style.left=document.body.clientWidth/2-150;
    div.style.top=document.body.clientHeight/2-25;
    }
    </script><form onsubmit="showMsg('正在加载数据...');" action="http://mail.163.com">
    <input type="submit" value="submit">
    </form>
      

  2.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head><body>
    <form id="form1" name="form1" method="post" action="http://www.google.com">
      <p>
        用户名:
          <input type="text" name="textfield" />
    </p>
      <p>
        密码:
          <input type="text" name="textfield2" />
    </p>
      <p>
        <label>
        <input type="button" name="Submit" value="提交吧" onclick="document.all.form1.submit();alert('感谢您提交的申请,我们稍后会进行处理。');"/>
        </label>
      </p>
    </form>
    </body>
    </html>-----------
    看看这样行不行?
      

  3.   

    同意xiao7cn(烧鸡)
    把button的onclick写在一个函数里,第一行写myform.submit();然后写弹出
    <script type="text/javascript">
      function formsubmit(){
         myform.submit();
         alert("感谢您的提交!");
      }
    </script><form name="myform">
       <input type="button" value="提交" onclick="formsubmit()">
    </form>