12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>酷炫网络</title>
- <script src="nameList.js"></script>
- <style type="text/css">
- *{margin:0;padding:0;list-style-type:none;}
- a,img{border:0;}
- body{
- font:12px/180% "Microsoft YaHei","微软雅黑", "宋体";
- background: url(img/1.jpg) #d7a800 no-repeat;
- background-size: 100%;
- }
- #container{
- }
- #box{
- margin:auto;font-size:80px;line-height: 80px;
- overflow:hidden;color:#138eee;text-align:center;
- color: #fff;
- margin-top: 300px;
- }
- #bt{
- margin:auto;width:400px;text-align:center;
- font-size:45px;cursor:pointer;
- color: #da0000;line-height: 100px;
- background: url(img/bgButton.png) no-repeat;
- background-size:100%;
- font-weight: bold;
- margin-top: 100px;
- }
- </style>
-
- </head>
- <body>
- <div id="container">
- <div id="box">宝贝们,准备好了吗?</div>
- <div id="bt" onClick="doit()">开始</div>
- </div>
- </body>
- </html>
- <script type="text/javascript">
- //nameList 所有人的名单
- //nameList02 去除中奖人的名单
- //prizeNameList 中奖人的名单
- //local 本地存储的中奖人的名单
- let mytime=null;
- // let nameList02 = [];
- // let prizeNameList = [];
- // let local = localStorage.getItem('prizeNameList');
- // if(local){
- // prizeNameList = local.split(',');
- // }
- // remove();
- // function remove () {
- // //去除已经抽中奖的人名
- // nameList02 = nameList.filter(function(s){
- // if(prizeNameList.indexOf(s) != -1){
- // return false;
- // }else{
- // return s;
- // }
- // });
- // }
-
- console.log(nameList.length);
-
- function doit(){
- if(mytime==null){
- document.getElementById('bt').innerHTML="停止";
- show();
- }else{
- // prizeNameList.push(document.getElementById("box").innerHTML)
- // localStorage.setItem("prizeNameList",prizeNameList);
- document.getElementById('bt').innerHTML="开始";
- clearTimeout(mytime);
- mytime=null;
- // remove();
- }
- }
- function show(){
- var box=document.getElementById("box");
- // if(nameList02.length == 0){
- // box.innerHTML = '哇,人员全部中奖!'
- // clearTimeout(mytime);
- // document.getElementById('bt').innerHTML="开始";
- // return;
- // }
- var num=Math.floor((Math.random()*100000))%nameList.length;
- box.innerHTML=nameList[num];
- mytime=setTimeout("show()",1);
- }
-
- </script>
|