如果您對使用JS庫不太反感,那麼您可以考慮使用JQuerys UI庫。
http://jqueryui.com/progressbar/
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Progressbar - Default functionality</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(function() {
$("#progressbar").progressbar({
value: 50
});
});
</script>
</head>
<body>
<div id="progressbar"></div>
</body>
</html>
如果你將它與JQuery的Ajax請求相結合,那麼你應該能夠達到你所追求的:http://api.jquery.com/jquery.ajax/
然後,您可以定期調用服務器端頁面獲得一個值來填充進度條。
讓我知道,如果這是直接的方向,我可以闡述,如果需要的話。