<!DOCTYPE?html>
<html>
?<head>
?<meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"/>?
?<title>8-17編程練習(xí)</title>??
?</head>
?<body>
??<!--先編寫好網(wǎng)頁布局-->
??<div?id="hint">
??????<h2>操作成功</h2>
??????<span><b?id="second"></b>前往慕課網(wǎng)<a?href="javascript:void(0)"??onclick="window.history.back()">返回</a></span>
??</div>
??<button?id="skbut"?onclick="skip()">前往慕課網(wǎng)</button>
?
??<script?language="javascript"?type="text/javascript">??
????var?hint?=?document.getElementById("hint");
????????hint.style.display?=?"none";
????var?skbut?=?document.getElementById("skbut");
????????skbut.style.display?=?"block";
skbut.style.cursor?=?"pointer";
????var?second?=?5;
????????function?sum(){
second--;
????????????document.getElementById("second").innerHTML?=?second;
if(second?>?0){
setTimeout(sum,1000);
}else{
clearTimeout;
}
????????};
????????
????????function?window_(){
????????????window.open('http://idcbgp.cn/','_self');
????????}
????
????????function?skip(){
????????????if(hint.style.display?==?"none"){
hint.style.display?=?"block";
skbut.style.display?=?"none";
};
document.getElementById("second").innerHTML?=?second;
setTimeout(sum,1000);
setTimeout(window_,5000);
????????};
??</script>?
</body>
</html>
2018-06-10
44行優(yōu)化一下改為?setTimeout(window_,second*1000);
2018-06-02
emmmm,想法不錯,操作體驗感覺挺棒的.特別是加了一個前往按鈕
2018-05-23
有點難