不知道有什么問題,秒數(shù)不減
<body>
? <!--先編寫好網(wǎng)頁布局-->
? <h1>操作成功</h1><br/>
? <p>
? ? ? <b id="num">5</b>秒后回到主頁
? </p>
? <script type="text/javascript">??
?
? ?//獲取顯示秒數(shù)的元素,通過定時器來更改秒數(shù)。
? ?var i = 5;
? ?function count(){
? ? ? var s = document.getElementById("num");
? ? ? ?i--;
? ? ? ?s.value = i;
? ? ? ?if(s < 0){
? ? ? ? ? ?window.open("http://idcbgp.cn","_blank");
? ?}
? ?setInterval("count()", 1000);
? ? function back(){
? ? ? ? window.history.back();
? ? }
?</script>
?<input type="button" value="返回" onclick="back()">
?</body>
2018-04-04
if(s < 0){
? ? ? ? ? ?window.open("http://idcbgp.cn","_blank");
這部分代碼,少了右邊的大括號,原文中后面緊接著的大括號是屬于function count的