<script type="text/javascript">
$(function() {
var j = 0;
$(document).on('selectstart', function() {
return false
})
var timer,
n = 0
$('.box p').on('click', function() {
if (j == 0) {
j = 1;
$(".but").html("点名中");
timer = setInterval(function() {
n++
$('.box div').each(function(k, v) {
$('.box div').eq(k).css({
'background': color(),
'color': color()
})
})
console.log(n)
if (n >= 20) {
clearInterval(timer)
j = 0;
$(".but").html("开始点名");
n = 0
$('.box div').css({
'background': 'orangered',
'color': 'white'
})
$('.box div').eq(name()).css({
'background': 'white',
'color': 'blueviolet'
})
}
}, 100)
}
})
/*随机索引号,需要改的就直接改数字,多少人就改成多少个*/
function name() {
return Math.floor(Math.random() * 24)
}
/*随机的颜色封装函数*/
function color() {
var r = Math.floor(Math.random() * 256)
var g = Math.floor(Math.random() * 256)
var b = Math.floor(Math.random() * 256)
return 'rgb(' + r + ',' + g + ',' + b + ')'
}
})
</script>
*
回帖描述:*
链接类型:*
下载链接:*
描述:*
回帖描述:*
链接类型:*
阅读权限:*
下载链接:



聚优部落技术论坛 © 版权所有 鲁ICP备15007479号-6
Copyright(C)web.com, All Rights Reserved.
