点击返回没有用,咋回事?
<!DOCTYPE html>
<html>
<head>
<title>浏览器对象</title>
<meta http-equiv="Content-Type" content="text/html; charset=gkb" />
<style type="text/css">
a{
cursor:pointer;
color:blue;
}
</style>
</head>
<body>
<h4>操作成功</h4>
<p><span id="time">5</span>秒后回到主页<a onclick="goBack()">返回</a></p>
<script type="text/javascript">
//获取页面秒数5,存储在num;
var num = 5;
function timeCount(){
document.getElementById("time").innerHTML=num;
num--;
if (num == 0){
location.assign('http://www.imooc.com');
}
}
setInterval('timeCount()',1000);
function goBack(){
window.history.back();
}
</script>
</body>
</html>