admin管理员组

文章数量:1535068

<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			#div1 {
				width: 0px;
				height: 20px;
				background-color: red;
				text-align: center;
			}
		</style>
	</head>

	<body>
		<button οnclick="down()">开始下载</button>
		<br />
		<div id="div1"></div>
	</body>
	<script>
		var count = 0;
		var tid;

		function getCount() {
			count++;
			if (count > 100) {
				f1()
			} else {
				var div = document.getElementById("div1")
				div.innerText = count + "%"
				div.style.width = 3 * count + "px"
			}
		}

		function down() {
			tid = setInterval("getCount()", 10)
		}

		function f1() {
			clearInterval(tid)
			alert("下载完成。。。。")
		}
	</script>

</html>

本文标签: 进度条js