<!doctype html>
<html><head>
<meta charset="utf-8">
<title>無標題檔案</title>
<style type="text/css">
body{ background-image:url(../imges/03.png); background-size:cover; background-repeat:no-repeat; }
#dl{ margin-top:200px; margin-left:auto; margin-right:auto; width:600px; height:200px; color:#CCC; background-color:#F00; font-family:"微軟雅黑"; font-size:20px; font-weight:bolder; text-align:center; padding-top:40px; }
#bt{ border:outset; border-color:#06F; text-align:center; margin-left:auto; margin-right:auto; margin-top:50px; height:10px; width:90px; color:#FFF; border-radius:50px; background-color:#06F; font-family:"微軟雅黑"; font-size:20px; font-weight:bolder; line-height:28px; cursor:pointer; padding-bottom:30px; padding-top:5px; }
</style>
<script type="text/javascript">
var namelist =["王五","趙六","張三","李四","孫七"];
var mytime =null;
function doit(){
var bt = window.document.getElementById("bt"); if(mytime=null){
bt.innerHTML="停止點名";
show();
}else{
bt.innerHTML="開始點名"; clearTimeout(mytime);
mytime=null;
}
}
function show(){
var dl = window.document.getElementById("dl");
var num=Math.floor(Math.random()*namelist.length); dl.innerHTML=namelist[num];
mytime=setTimeout("show()",1);
}
</script>
</head>
<body>
<div id="dl">親們,準備好點名了嗎?</div>
<div id="bt" onClick="doit()">開始點名</div>
</body></html>
uj5u.com熱心網友回復:
比較運算子兩個=if (mytime == null)
uj5u.com熱心網友回復:
謝謝謝謝
找到了 可以用了
uj5u.com熱心網友回復:
謝謝謝謝
找到了 可以用了
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/59686.html
標籤:JavaScript
下一篇:不同客戶端登陸不同賬號
