1. 程式人生 > >jsp頁面實現倒計時自動跳轉

jsp頁面實現倒計時自動跳轉

在頁面上顯示倒計時

	<script type="text/javascript">
		function out(sec){
			var v = document.getElementById("h1");
			if(--sec>0){
				setTimeout("out("+sec+")", 1000);
			}
			v.innerHTML=sec;
		}
	</script>
<body onload="out(6)">
	<h4 align="center">pls wait...<span id="h1"></span></h4>
	<%response.setHeader("Refresh", "5, URL=list.action"); %>
</body>