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

Tah*_*ale 3 javascript pleasewait popupwindow web

这是我的脚本:

<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>
Run Code Online (Sandbox Code Playgroud)

我希望当用户点击"下一页"按钮加载或请等待将弹出,因为下一页需要超过30秒,我希望成员知道该网站正在运行,但也让弹出窗口消失页面加载后.

此外,如果你想看到按钮在运行我的网站是www.socialmedianetworkexchange.com,当你点击"赚取facebook喜欢"按钮时.

Nat*_*han 10

您可以在单击它时在页面上显示一个元素,然后它将自行消失(一旦进入新页面).这是我刚刚制作的代码:

JavaScript的:

function showLoading() {
    document.getElementById('loadingmsg').style.display = 'block';
    document.getElementById('loadingover').style.display = 'block';
}
Run Code Online (Sandbox Code Playgroud)

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>
Run Code Online (Sandbox Code Playgroud)

当然,您可以将加载消息更改为您想要的任何内容.

我希望这有帮助.如果您有任何疑问,请告诉我.


编辑:

只需添加onclick事件即可<li>:

<li onclick="showLoader();">
<a href="facebook.php">
<img src="images/logos/facebooklikeicon.png" height="25" border="0" /> Earn Coins Facebook 
</a>
</li>
Run Code Online (Sandbox Code Playgroud)

确保在此之上有其他HTML,CSS和JavaScript,以使该功能正常工作.

如果您有任何不理解的部分,请告诉我.