我有一个带有表单的网站,该表单使用 PHP 发送表单数据。有没有一种方法可以在页面上创建一个看起来像是在运行的进度条,以便人们在单击按钮并发送 PHP 信息后不会多次单击该按钮。
谢谢。
原文由 The Woo 发布,翻译遵循 CC BY-SA 4.0 许可协议
Web 内容上的进度条很难正确,因为您不知道该过程将花费的总时间,并且您没有该过程的进度指示器来让您知道何时更新您的进度条。您最好使用像 ajaxload.com 上可用的旋转加载图像。
您可以让一个隐藏的 div 覆盖整个页面,并在您等待时在您的 javascript 中激活该 div。
在你的 html 中:
<div style="display:none;" id="wait"></div>
在 CSS 中:
#wait {
position:fixed;
top:50%;
left:50%;
background-color:#dbf4f7;
background-image:url('/images/wait.gif'); // path to your wait image
background-repeat:no-repeat;
z-index:100; // so this shows over the rest of your content
/* alpha settings for browsers */
opacity: 0.9;
filter: alpha(opacity=90);
-moz-opacity: 0.9;
}
然后在你的 JavaScript 中:
...
$("#wait").show(); // when you want to show the wait image
...
$("#wait").hide(); // when your process is done or don't worry about it if the page is refreshing
原文由 Chris Williams 发布,翻译遵循 CC BY-SA 3.0 许可协议
2 回答909 阅读✓ 已解决
3 回答810 阅读✓ 已解决
2 回答1.5k 阅读✓ 已解决
4 回答1.2k 阅读✓ 已解决
2 回答1.5k 阅读✓ 已解决
2 回答1.3k 阅读✓ 已解决
2 回答877 阅读✓ 已解决
进度条:简单文本版本:
进度条:基于 PHP(图形):