Javascript 提交后弹出。显示加载窗口或请稍候

Javascript 提交后弹出。显示加载窗口或请稍候,javascript,web,popupwindow,pleasewait,Javascript,Web,Popupwindow,Pleasewait,这是我的剧本: <form action='' method='' onsubmit='refreshpage();'> <input name='refresh' type="image" SRC="images/Next-Page-Button.gif" HEIGHT="60" WIDTH="173" BORDER="0" value='Refresh'> </form> 我希望它当用户点击“下一页”按钮加载或请等待将弹出,因为它需要超过30秒的下一

这是我的剧本:

<form action='' method='' onsubmit='refreshpage();'>
<input name='refresh' type="image" SRC="images/Next-Page-Button.gif" HEIGHT="60" WIDTH="173" BORDER="0" value='Refresh'>
</form>

我希望它当用户点击“下一页”按钮加载或请等待将弹出,因为它需要超过30秒的下一页,我希望成员知道该网站正在工作,但也使弹出消失后,页面加载


另外,如果你想看到按钮的作用,我的网站是,当你点击“赢得facebook喜欢”按钮时。当他们点击时,你可以在页面上显示一个元素,然后在导航到另一个页面时,它会自动消失

JavaScript:

function showLoading() {
    document.getElementById('loadingmsg').style.display = 'block';
    document.getElementById('loadingover').style.display = 'block';
}
HTML/CSS:

<style type="text/css">
      #loadingmsg {
      color: black;
      background: #fff; 
      padding: 10px;
      position: fixed;
      top: 50%;
      left: 50%;
      z-index: 100;
      margin-right: -25%;
      margin-bottom: -25%;
      }
      #loadingover {
      background: black;
      z-index: 99;
      width: 100%;
      height: 100%;
      position: fixed;
      top: 0;
      left: 0;
      -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
      filter: alpha(opacity=80);
      -moz-opacity: 0.8;
      -khtml-opacity: 0.8;
      opacity: 0.8;
    }
</style>

<div id='loadingmsg' style='display: none;'>Redirecting, please wait...</div>
<div id='loadingover' style='display: none;'></div>
<form action='' method='post' onsubmit='refreshpage();showLoading();'> 
   <input name='refresh' type="image" src="images/Next-Page-Button.gif" height="60" width="173" border="0" value='Refresh'> 
</form>

确保在上面还有其他HTML、CSS和JavaScript,以便功能正常工作。

当您可以使用AJAX提交表单时,为什么要刷新页面?它需要将信息发送到数据库,让更多站点“喜欢”哦,AJAX也做同样的事,但没有页面刷新;)它基本上是提交表单,但没有刷新页面。有关装载内容,请参见下面的答案。:)看
$。post
$。get
更易于使用如果您只打算使用某个方法类型,请参阅以下链接:或者我将如何使>重定向,请稍候…<进入动画image@CaleAllen-你可以从中获取加载GIF,它们有许多不同类型的加载图标。只需在“重定向,请稍候…”文本旁边的div中使用一个
。因此,我有这个按钮,如何让它执行相同的操作
  • 如果这有帮助,请单击上面我的答案旁边的复选标记。谢谢:)
    <li onclick="showLoading()">
       <a href="facebook.php">
          <img src="images/logos/facebooklikeicon.png" height="25" border="0" /> Earn Coins Facebook 
       </a>
    </li>