1<! DOCTYPE html>234<meta charset= "UTF-8" >5<title> Lottery Games </title>6<style>7 #box {8 width:720px;9margin:0Auto;Tenmargin-top:20px; Onebox-shadow:0px 0px 2px #333; A } - . pic{ - width:200px; the height:200px; - float: Left; -line-height:200px; - margin:10px; + border:5px #fff solid; - Color:blue; +font-size:35px; Atext-Align:center; at } - . anniu{ - width:200px; - height:200px; - float: Left; - margin:10px; in } - #drawBtn { to color:red; +font-size:30px; - width:200px; the height:200px; *box-shadow:0px 0px 2px #333; $font-Weight:bold;Panax Notoginseng } -</style> the<script> +Window.onload=Init; A varsetting={ thecount:0, +Total:24, -Delay:20, $picindex:[0,1,2,4,7,6,5,3] $ } - functioninit () { -document.getElementById ("Drawbtn"). onclick=function(){ theSetting.count=0; -Setting.delay=20;Wuyi This. disable=true;//Disable button the vardrawbtn= This; - //get the div for all pictures Wu varAlldivs=document.getelementsbyclassname ("Pic"); - //get a random integer representing the location of the jackpot, 3*8+ (0-7) AboutSetting.total+=math.floor (Math.random () *alldivs.length); $ //set the timer, and then modify the color of each div border in turn. -SetTimeout (functionShow () { - //Reset The color of the previous border - for(vari=0;i<alldivs.length;i++){ AAlldivs[i].style.bordercolor= "#fff"; +alldivs[i].style.opacity=0.7; the } - //Find the color setting for the border you want to modify $ varCurrentpic=alldivs[setting.picindex[setting.count%8]]; theCurrentpic.style.bordercolor= "Red"; thecurrentpic.style.opacity=1.0; thesetting.count++; thesetting.delay+=2*Setting.count; - if(setting.count>setting.total) { inAlert ("You won, haha"); thedrawbtn.disable=false; the return; About } the setTimeout (show,setting.delay); the },setting.delay); the } + } -</script> theBayi<body> the<div id= "box" > the<div class= "pic" >1</div> -<div class= "pic" >2</div> -<div class= "pic" >3</div> the<div class= "pic" >4</div> the<div class= "Anniu" ><input type= "button" value= "I Want Lottery" id= "drawbtn"/></div> the<div class= "pic" >5</div> the<div class= "pic" >6</div> -<div class= "pic" >7</div> the<div class= "pic" >8</div> the</div> the</body>94JavaScript Marquee Raffle