暫無描述

index.html 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>酷炫网络</title>
  6. <script src="nameList.js"></script>
  7. <style type="text/css">
  8. *{margin:0;padding:0;list-style-type:none;}
  9. a,img{border:0;}
  10. body{
  11. font:12px/180% "Microsoft YaHei","微软雅黑", "宋体";
  12. background: url(img/1.jpg) #d7a800 no-repeat;
  13. background-size: 100%;
  14. }
  15. #container{
  16. }
  17. #box{
  18. margin:auto;font-size:80px;line-height: 80px;
  19. overflow:hidden;color:#138eee;text-align:center;
  20. color: #fff;
  21. margin-top: 300px;
  22. }
  23. #bt{
  24. margin:auto;width:400px;text-align:center;
  25. font-size:45px;cursor:pointer;
  26. color: #da0000;line-height: 100px;
  27. background: url(img/bgButton.png) no-repeat;
  28. background-size:100%;
  29. font-weight: bold;
  30. margin-top: 100px;
  31. }
  32. </style>
  33. </head>
  34. <body>
  35. <div id="container">
  36. <div id="box">宝贝们,准备好了吗?</div>
  37. <div id="bt" onClick="doit()">开始</div>
  38. </div>
  39. </body>
  40. </html>
  41. <script type="text/javascript">
  42. //nameList 所有人的名单
  43. //nameList02 去除中奖人的名单
  44. //prizeNameList 中奖人的名单
  45. //local 本地存储的中奖人的名单
  46. let mytime=null;
  47. // let nameList02 = [];
  48. // let prizeNameList = [];
  49. // let local = localStorage.getItem('prizeNameList');
  50. // if(local){
  51. // prizeNameList = local.split(',');
  52. // }
  53. // remove();
  54. // function remove () {
  55. // //去除已经抽中奖的人名
  56. // nameList02 = nameList.filter(function(s){
  57. // if(prizeNameList.indexOf(s) != -1){
  58. // return false;
  59. // }else{
  60. // return s;
  61. // }
  62. // });
  63. // }
  64. console.log(nameList.length);
  65. function doit(){
  66. if(mytime==null){
  67. document.getElementById('bt').innerHTML="停止";
  68. show();
  69. }else{
  70. // prizeNameList.push(document.getElementById("box").innerHTML)
  71. // localStorage.setItem("prizeNameList",prizeNameList);
  72. document.getElementById('bt').innerHTML="开始";
  73. clearTimeout(mytime);
  74. mytime=null;
  75. // remove();
  76. }
  77. }
  78. function show(){
  79. var box=document.getElementById("box");
  80. // if(nameList02.length == 0){
  81. // box.innerHTML = '哇,人员全部中奖!'
  82. // clearTimeout(mytime);
  83. // document.getElementById('bt').innerHTML="开始";
  84. // return;
  85. // }
  86. var num=Math.floor((Math.random()*100000))%nameList.length;
  87. box.innerHTML=nameList[num];
  88. mytime=setTimeout("show()",1);
  89. }
  90. </script>