感谢您的支持,我会继续努力的!
打开微信扫一扫,即可进行扫码打赏哦
点我查看本站打赏源码!
Powered by RUNCODEX.COM,学的不仅是技术,更是梦想!!!
<script src="https://cdn.staticfile.org/jquery/2.2.4/jquery.min.js"></script>
<div>
<input type="submit" value=""/>
<button id="start">
开始闪
</button>
<button id="end">
结束闪
</div>
xxxxxxxxxx
var arr=["#96B97D","#5CB85C","#7033CC","#946ECC","#FF0059","#808080"]
var clear = false;
function tik(){
var a =[];
$("input").css("background-color","#FFA600")
while (a.length!==3){
var num = Math.floor(Math.random()*9);
if (a.indexOf(num)==-1)
a.push(num);
}
for (var i=0;i<3;i++){
var b=Math.floor(Math.random()*6);
$("input").eq(a[i]).css("background-color",arr[b])
t=setTimeout("tik()",1000);
$("button#start").click(function(){
if (clear==false)
tik()
clear=true;
})
$("button#end").click(function(){
clearTimeout(t)
clear=false
input{
width:50px;
height:50px;
margin:1px;
float:left;
background-color:#FFA600;
border:none;
border-radius:5px;
div{
display:table;
background-color:#FFFFFF;
padding:3px;
width:156px;
button{
width:100%;
border:1px solid #FFA600;
color:#FFA600;
margin-top:2px;
button:hover{
color:#FFFFFF;