如何显示文本以及JQuery进度条,并在完成后转发到其他JSP页面
How to Display Text along with JQuery Progressbar and forward to some other JSP page after completing?
我有进度条。如果它工作得很好,但我需要显示一些文本与进度条& &;当它达到100%时,它应该转发一个JSP页面。这是我的项目,增加了10%我想打印一些文本,比如:
- 10% ->上传个人资料
- 20% ->查看Email ID
-
30% ->生成用户ID。
,
重要的是,在达到100%后,必须将其转发给某个.jsp。如何做到这一点。请建议。这是我的程序:
在mystyle.css:<html> <head> <link rel="stylesheet" type="text/css" href="mystyle.css"> <script type='text/javascript'> var progress = setInterval(function() { var $bar = $('.bar'); if ($bar.width()==400) { clearInterval(progress); $('.progress').removeClass('active'); } else { $bar.width($bar.width()+40); } $bar.text($bar.width()/4 + "%"); }, 800); </script> </head> <body> <script src="http://code.jquery.com/jquery.js"></script> <script src="js/bootstrap.min.js"></script> <div class="container"> <div class="progress progress-striped active"> <div class="bar" style="width: 0%;"></div> </div> </div> </body> </html>
@import url('css/bootstrap.css'); .container { margin-top: 30px; width: 400px; }
您可以使用Javascript使用window.location.replace
window.location.replace("http://example.com/finishedLoading");
您必须跟踪您的进度,并根据此显示消息。完成后,执行重定向。
根据你的例子:
<html>
<head>
<script type='text/javascript'>
var progress = setInterval(function() {
var $bar = $('.bar');
if ($bar.width()==400) {
clearInterval(progress);
$('.progress').removeClass('active');
window.location.replace("http://example.com/finishedLoading");
} else {
$bar.width($bar.width()+40);
switch($bar.width()){
case 40: $("#status").html("Uploading Personal Details"); break;
case 80: $("#status").html("Checking Email ID"); break;
case 120: $("#status").html("Generating user ID"); break;
// other case statements...
case 400: $("#status").html("Finished"); break;
}
}
$bar.text($bar.width()/4 + "%");
}, 800);
</script>
</head>
<body>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
<div class="container">
<div class="progress progress-striped active">
<div class="bar" style="width: 0%;"></div>
</div>
<br>
<span id="status">
</div>
</body>
</html>
此处的进度直接保存在$bar.width()
中。
相关文章:
- 如何使用jQuery自动打开页面上的所有链接
- 使用agility.js进行页面布局和合成
- 当包含另一个asp文件时,是否也包含所有引用的样式和脚本页面
- 无法在通过jQuery的ajax加载的页面中执行javascript
- 使用javascript将动态表从一个html页面打印到另一个html页
- PHP和Javascript转发页面
- 页面未通过createRenderUrl转发
- AngularJS:转发到登录页面进行身份验证,保留路由作为GET参数
- 如何将传递给 nodejs 的查询字符串转发到通过 res.render 提供的页面
- 如何使用 RequestDispatcher 从 servlet 转发到内部页面链接
- 页面加载在页面中 -->转发到索引.html当页面单独加载时
- ajax调用响应被转发到浏览器上的新html页面
- Onchange参数以转发到正确的页面
- 如何停止浏览器转发按钮重定向到页面
- Javascript有页面转发和页面重定向的区别吗
- Greasemonkey:转发整个页面内容
- 如何显示文本以及JQuery进度条,并在完成后转发到其他JSP页面
- 根据下拉列表中的选择转发到新页面,而不使用JavaScript
- 我有一个IE通知页面,但我怎么能让用户跳过它,并转发回索引
- 使用JavaScript函数返回值转发页面请求