<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
.time {
width: 200px;
height: 100px;
background-color: #CCCCCC;
border-radius: 50px;
text-align: center;
line-height: 100px;
}
</style>
</head>
<body>
<div class="time">
<span id="mytime">提示,<span id="bbb">3</span>秒后页面跳转到百度</span>
<a href="http://www.baidu.com">手动点击跳转至百度</a>
</div>
</body>
<script type="text/javascript">
var obj = document.getElementById("bbb");
var sobj = obj.innerHTML;
ting = setInterval(function() {
obj.innerHTML = --sobj;
if(sobj <= 0) {
clearInterval(ting);
window.location = 'http://www.baidu.com';
}
}, 1000);
</script>
</html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
.time {
width: 200px;
height: 100px;
background-color: #CCCCCC;
border-radius: 50px;
text-align: center;
line-height: 100px;
}
</style>
</head>
<body>
<div class="time">
<span id="mytime">提示,<span id="bbb">3</span>秒后页面跳转到百度</span>
<a href="http://www.baidu.com">手动点击跳转至百度</a>
</div>
</body>
<script type="text/javascript">
var obj = document.getElementById("bbb");
var sobj = obj.innerHTML;
ting = setInterval(function() {
obj.innerHTML = --sobj;
if(sobj <= 0) {
clearInterval(ting);
window.location = 'http://www.baidu.com';
}
}, 1000);
</script>
</html>