1<! DOCTYPE html>234<meta charset= "UTF-8" >5<title> Lottery Program </title>6<script type= "Text/javascript" src= "Http://common.cnblogs.com/script/jquery.js" ></script>7<script>8$(function () {9 varTime ,Ten I, Oneidx= "01247653", Aitems=$ ('. Test1 ')), -num=Items.length, -Gameover=true; the -$ (' #start '). Click (function(){ - if(gameover) { -Gameover=false; +Time=math.random () *20; -I=7; + setTimeout (loop,time); A } at }); - - functionLoop () { -Items.removeclass (' Active '); -Items.eq (Idx.charat (I%num)). addclass (' active '); -i++; in if(time<500) {//Set threshold value - //The longer the time, the slower the execution, and the more slowly the effect to //math.random () * (N-M) +m returns the formula for the random number (between m-n) of the specified range +time+= parseint (Math.random () * (20-10) +10,10); - setTimeout (loop,time); the}Else{ *Gameover=true; $Alert (Items.filter ('. Active ')). text ());Panax Notoginseng } - } the }); +</script> A the<body> +<style> - . test1,.test2{ $ width:20px; $ height:20px; - border:1px solid red; -display:inline-Block; the Overflow:hidden; - }Wuyi the . active{ - background:red; Wu } -</style> About<div id= "Container" > $<div class= "Test1" >1</div> -<div class= "Test1" >2</div> -<div class= "Test1" >3</div> -<br/> A<div class= "Test1" >4</div> +<div id= "Start" class= "Test2" > Pump </div> the<div class= "Test1" >5</div> -<br/> $<div class= "Test1" >6</div> the<div class= "Test1" >7</div> the<div class= "Test1" >8</div> the</div> the</body> -Effect:
Reference:
Http://www.gbtags.com/gb/rtreplayerpreview/195.htm
http://www. Gbtags. COM/GB/rtwidget-replayer/192.htm
A simple lottery program.