<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>点名</title>
<script language="javascript" type="text/javascript">
var status = 1;
var name = new Array('范 鹏','张子涵','代天明','孙 季','孙 磊','王鸿罡','曾凡丁','李 欢','朱 颖','王 莎','郑琳琳','朱振家','金 一','李成龙','苟 超','吴 桐','梁 良','刘 俊');
function getname(){
return name[Math.floor(Math.random()*name.length)];
}
function showname(){
document.getElementById("name").innerHTML = getname();
setTimeout("showname",200);
}
function goname(){
intimer = setInterval(showname, 200);
}
function stopname(){
if(status == 1){
clearInterval(intimer);
status = 0;
}else{
intimer = setInterval(showname, 200);
status = 1;
}
}
</script>
<style>
#name{
border:1px solid #000;
margin:auto;
font-size:36px;
color:#000000;
width:108px;
height:1em;
cursor:pointer;
text-align:center;
}
</style>
</head>
<body>
<div></div>
</body>
</html>
使用javascript做的一个随机点名程序
内容版权声明:除非注明,否则皆为本站原创文章。