js 無提示自動定時關閉頁面


<body>
	 <div class="wrap" style="min-height:400px">
	 	<div class="i-img"></div>
		<div class="main">
			<h1 style="text-align:center; margin-top:50px">支付成功!</h1>
			<h3 style="text-align:center; margin-top:20px">即將關閉: <span id="num">5</span>秒</h3>
		</div>
	 </div>
</body>
<script>
$(function() {    
    jump(5);    
});    

function jump(count) {    
    window.setTimeout(function(){    
        count--;    
        if(count > 0) {    
            $('#num').text(count);   
            jump(count);    
        } else {    
        	window.opener=null;
        	window.open('','_self');
        	window.close();
        }    
    }, 1000);    
}
</script>


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章