Home > front end >  Js did made a lottery system
Js did made a lottery system

Time:12-16



<meta charset="UTF-8">
<meta name="viewport" content="width=device - width, initial - scale=1.0" & gt;
<meta HTTP - equiv="X - UA - Compatible" content="ie=edge" & gt;
Random name & lt;/title> <br/><style> <br/># content {<br/>width:100%; <br/>height: 100%; <br/>Background: # ffaa7f; <br/>Margin: 100 px auto; <br/>text-align: center; <br/>position: relative; <br/>Margin - top: 150 px; <br/>The line - height: 350 px; <br/>color: dodgerblue; <br/>The font - size: 70 px; <br/>} <br/># btn1 {<br/>background: #ccc; <br/>Width: 180 px; <br/>Height: 80 px; <br/>font-size: 30px; <br/>Color: # f40; <br/>Border - the radius: 12 px; <br/>position: absolute; <br/>Bottom: 30 px; <br/>Left: 29%; <br/>Margin - left: - 90 px; <br/><br/>} <br/># btn2 {<br/>background: #ccc; <br/>Width: 180 px; <br/>Height: 80 px; <br/>font-size: 30px; <br/>Color: # f40; <br/>Border - the radius: 12 px; <br/>position: absolute; <br/>Bottom: 30 px; <br/>Right: 13%; <br/>Margin - left: - 90 px; <br/><br/>} <br/># button - group {<br/>position: relative; <br/>Top: 15 px; <br/>} <br/># BTN - sontent {<br/>position: relative; <br/>Bottom: 55 px; <br/><br/>} <br/></style> <br/></head> <br/><body> <br/><Div id="content" & gt; <br/><Div id="BTN - sontent" & gt; <br/><Span id="span1" & gt; Click start & lt;/span> <br/><br/><Div id="button - group" & gt; <br/><The button id="btn1" onclick="" & gt; Going to call the roll & lt;/button> <br/><The button id="btn2" & gt; Start again & lt;/button> <br/></div> <br/></div> <br/><br/></div> <br/><br/><script> <br/>Var arr=[' Zhang Wenxin ', 'CAI penang wei', 'Cheng Donghui', 'Chen Jihao', 'Chen', 'jc Chen', 'si-jia Chen', 'major dong', 'Duan Chunxiao', 'FuYongXiu', 'Gao Wen]; <br/>Var $btn1=document. GetElementById (" btn1 "); <br/>Var $btn2=document. GetElementById (" btn2 "); <br/>Var $content=document. GetElementById (" content "); <br/>Var $span1=document. GetElementById (' span1 '); <br/>var timer;//timer <br/>Var testNum=true; <br/>$btn1. Onclick=function () {<br/>If (testNum) {<br/>//the console. The log (1); <br/>start(); <br/>$btn1. InnerHTML='you! '; <br/>TestNum=false; <br/>} <br/>The else {<br/>//the console. The log (0); <br/>Stop (); <br/>$btn1. InnerHTML='to'; <br/>TestNum=true; <br/><br/>} <br/>} <br/>$btn2. Onclick=function () {<br/>Restart (); <br/>} <br/><br/>The function start () {<br/>//timer=setInt erval (function () {<br/>//var num=random (1, arr. Length - 1); <br/>//$span1. InnerHTML=arr (num); <br/>//}, 10) <br/>The timer=setInterval (function () {<br/>Var num=random (0, arr. Length) <br/>$span1. InnerHTML=arr (num) <br/>}, 10) <br/>} <br/>The function the stop () {<br/>//clearInterval () is used to stop the setinterval function <br/>clearInterval(timer); <br/>} <br/>The function restart () {<br/>$span1. InnerHTML='click start; <br/>} <br/>//random function <br/>The function of random (a, b) {<br/>Var randomNum=Math. Round (Math. The random () * (b - a)) + a; <br/>//var test=Math. Round (math.h random () * (13-7)) + 7; <br/>Return randomNum; <br/>} <br/></script> <br/></body> <br/></html> <br/> </div> <div class="th_page th_page_color"></div> <div class="umCopyright"> <p>Page link:<a href="/frontend/94613.html" target="_blank" style="color:#999">https//www.codepudding.com/frontend/94613.html</a></p> </div> <div class="detail-arr"> <div class="detail-arr-left">Prev:<a href='/frontend/94612.html'>Pray god guide!!!!!! Pure white</a></div> <div class="detail-arr-right">Next:<a href='/frontend/94614.html'>All bosses with js to help</a></div> </div> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="hot-tags neitags"> <ul> <li><i class="iconfont icon-x-tags"></i> Tags:  </li> <a href='/e/tags/?tagname=JavaScript' target='_blank'>JavaScript</a> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="xiangguan"> <ul class="msg msghead"> <li class="tbname">Related</li> </ul> <ul> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="flinks"> <ul> <li><i class="iconfont icon-x-tags"></i> Links:  </li> <li class="liflinks"><a target="_blank" href="/" title="CodePudding">CodePudding</a></li> </ul> </div> </div> </div> </div> <div class="footer"> <p><span style="font-size:16px;color:#666;font-weight: bold">About Us:</span>  <a href="https://www.codepudding.com/contact.html">Contact Us</a>      <a href="https://www.codepudding.com/service.html">Terms of Service</a>      <a href="https://www.codepudding.com/privacy.html"> Privacy Policy</a></p> <p class="foot_info">Copyright © 2010-2023,Powered By <a href="/" target="_blank">CodePudding</a> </p> </div> <script type="text/javascript" src="/skin/code/tianhu.js"></script> </body></html>