為什么不顯示秒數(shù)?不能返回上一頁?
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對象</title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/> ??
?</head>
?<body>
? <p style="font-family:20px;color:red;">操作成功</p>
? <input type="text" id="miao" >
? <input type="button" value="返回" onclick="stop()">
?
? <script type="text/javascript"> ?
? var i;
? var a;
?function chuan()
?{
? ?document.getElementById("miao").value=i; ?
?}
?
?function miaoshu()
?{
? ? ?for(i=5;i>0;i--)
? ? ?{
? ? ? ? ?a=setTimeout(chuan,10000);
? ? ?}
?if(i==0) location.assign("http://idcbgp.cn/u/4482869");
?} ?//獲取顯示秒數(shù)的元素,通過定時器來更改秒數(shù)。
?function stop()
?{
? ? ?clearTimeout(a);
? ? ?window.history.back();
?}
miaoshu();
? ?//通過window的location和history對象來控制網(wǎng)頁的跳轉(zhuǎn)。
? ?
?</script>?
</body>
</html>
2017-02-14
??window.history.back(-1); ?你沒有加數(shù)值沒法返回上一頁,不計數(shù)是因為你沒有返回秒數(shù)的數(shù)值