随机点名小程序 - 轻松便捷的点名工具
<div class='box'>
<h1>随机点名小程序</h1>
<div class='nbox'>
<img src='appIcon.png'/>
<h4 id='title'>名字:黄泽明</h4>
<button id='button'>点击点名</button>
</div>
</div>
<script>
let intervalId;
var i = 0;
const op = ['陈绮涵','陈伟钦','罗宇涵','陈晓冰','魏嘉和','魏天宇','黄鸿博','胡墁熙','黄斯望','陈德聪','陈翠林','唐超','何浩铭','胡鑫','陈伟校','陈雅婷','陈琦鑫','黄佳津','颜秋婷','杨俊鑫','杨宗良','黄泽明','刘雅妮','刘珠绿','赵婷婷','罗曼娜','刘家希','曾诗诗','邱怡岚','邱杰祥','何锦欣','黎栩灿','罗越凯','黄钰璇','邱嘉琳','朱雅欣','吴圳恒'];
button.onclick=function () {
var star = Math.floor(Math.random() * op.length);
qdqd(); setTimeout(function(){clearInterval(intervalId);$("#title").text("名字:"+op[star]);},5000);
<pre><code> }
function qdqd(){
intervalId = setInterval(() => {
</code></pre>
<p>i++; $("#title").text("名字:"+op[i])
if (i >= op.length - 1) { i = 0; }
},20);
};
</script></p>
原文地址: https://www.cveoy.top/t/topic/oKen 著作权归作者所有。请勿转载和采集!