求解,動(dòng)不了
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對(duì)象</title>??
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/>? ?
?</head>
?<body>
? <!--先編寫好網(wǎng)頁布局-->
? <h4>操作成功</h4>
? <p><span id="clock"></span>秒后回到主頁<a herf="javascript:j()">返回</a></p>
?
? <script type="text/javascript">??
?
? ?//獲取顯示秒數(shù)的元素,通過定時(shí)器來更改秒數(shù)。
? ?var num=5;
? ?function i(){
? ? ? ?var time=new Date();
? ? ? ?document.getElementById("clock").innerHTML=num;
? ? ? ?num=num-1;
? ? ? ?if(num==0){
? ? ? ? ? window.history.back();?
? ? ? ?}
? ?}
? ?setInterval(i(),1000);
? ?//通過window的location和history對(duì)象來控制網(wǎng)頁的跳轉(zhuǎn)。
? ?function j(){
? ? ? ?window.location.href="www.baidu.com";
? ?}
?</script>?
</body>
</html>
2020-03-31
<!DOCTYPE html>
<html>
<head>
<title>瀏覽器對(duì)象</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
.link{
color:blue;
}
</style>
</head>
<body>
<!--先編寫好網(wǎng)頁布局-->
<h4>操作成功</h4>
<p><span id="clock">5</span>秒后回到主頁 ?<u class=link onclick="j()">返回</u>
<script type="text/javascript">
//獲取顯示秒數(shù)的元素,通過定時(shí)器來更改秒數(shù)。
var num = 5;
function i() {
num = num - 1;
if (num == 0) {
window.location.).innerHTML = num;
}
setInterval(i, 1000);
//通過window的location和history對(duì)象來控制網(wǎng)頁的跳轉(zhuǎn)。
function j() {
window.history.back();
}
</script>
</body>
</html>
2020-03-13
setInterval(i(),1000);
改為setInterval("i()",1000);
2020-03-12
操作成功<br><br>
?
操作成功<br><br>
? <span id="txt"></span>秒后返回到主頁 <a>返回</a>
var num=5;
?function i(){
? ? ?document.getElementById("txt").innerHTML=num;
? ? ?num=ary-1;
? ? ?setTimeout(i,1000);
if(num==0){
window.location.assign("http://idcbgp.cn/code/49");
}
?}
setTimeout(i,1000);