<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style type="text/css">
#body
{
background-color:#666666;
}
#box{
margin:auto;
width:50%;
font-size:66px;
height:300px;
line-height:94px;
text-align:center;
padding:0 30px;
margin-top:200px;
color:#FFF;
}
#bt{
margin:auto;
width:200px;
text-align:center;
margin-top:75px;
color:#FFF;
font-size:25px;
line-height:45px;
cursor:pointer;
height:45px;
background-color:orange;
}
</style>
</head>
<body id="body">
<div id="box">名单</div>
<div id="bt" onclick="doit()">开始点名</div>
<div id="bt" onclick="stopit()">结束点名</div>
<script type="text/javascript">
var namelist=[
"02010116李成基",
"02010121张圳",
"UI-02010302田歆妍",
"0022250408李梓萌",
"02010103骆文浩",
"02010106张震宇",
"02010107李炫宇",
"02010108李舜禹",
"02010111李奥",
"02010114鲁飞洋",
"02010115李俊达",
"02010120王昊健",
"02010126郑稍露",
"02010128李正鸿",
"02010129张诗卉",
"02010131黄磊",
"02010132胡坤"
];
var mytime=null;
function doit(){
var bt=window.document.getElementById('bt');
mytime==null
show();
}
function stopit(){
clearTimeout(mytime);
mytime=null;
}
function show(){
var box=window.document.getElementById('box');
var num=Math.floor(Math.random()*10000000)%namelist.length;
box.innerHTML=namelist[num];
mytime=setTimeout("show()",100);
}
</script>
</body>
</html>
开始点名时,让数组高速滚动,结束时清除时间
点名器