1 Star 0 Fork 5

956569011/c81

forked from 后盾人/c81 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
随机点名.html 1.67 KB
一键复制 编辑 原始数据 按行查看 历史
Nick 提交于 2017-07-12 09:29 . 随堂提交
<!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>
<script type="text/javascript">
var arr = ['索玉兵','陈浩','赵斌','索晓峰','韩治体','郭炳炳','连静鑫','索金华','宣亮','祁鹏晨','卓宝亮','茹文波','王文丽','王文军','张志锋','黄志成','吕星波','李静涛','卢少辉','王强','胡毅','孙涛','杨杰','刘星','杨利超','刘格','王雪陟','陈召','孙立','任小龙'];
function run(){//随机抽取一名同学
num = Math.floor(Math.random()*arr.length);
document.getElementById('sname').innerHTML = arr[num];
var c1 = Math.floor(Math.random()*120);
var c2 = Math.floor(Math.random()*120);
var c3 = Math.floor(Math.random()*120);
document.getElementById('sname').style.color = "rgb("+c1+","+c2+","+c3+")"
}
window.onload = function(){
document.getElementById('btn').onclick = function(){
var auto_time = setInterval(run,100);//设置定时器
setTimeout(function(){//清除定时器
clearInterval(auto_time);
// 删除同学
arr.splice(num,1);
},1000)
}
}
</script>
</head>
<body style="background:#ccc;">
<div style="width:300px;height:100px;margin:0 auto;margin-top:100px;">
<p id="sname" style="width:350px;height:60px;text-align:center;font-size:100px;font-weight:800;font-family:'叶根友刀锋黑草-企业版';letter-spacing:10px;">请点名</p>
<input type="button" value='开始点名' id="btn" style="margin:0 auto;display:block;" />
</div>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Mrchenyao/c81.git
[email protected]:Mrchenyao/c81.git
Mrchenyao
c81
c81
master

搜索帮助