抽奖

<html>
  <head>
  <meta charset="UTF-8">
  <title>抽奖</title>
  <style>
  * { margin: 0; padding: 0; box-sizing: border-box; }
  body { background-color:#EAEAEA; }
  .g1 { background: #A3D1D1;}
  .g2 { background: #BCEE68; }
  .g3 { background: #97CBFF; }
  .g4 { background: pink; }
  .g5 { background: #B9B9FF; }
  .g6 { background: #BDB76B; }
  .g7 { background: #fff2b2; }
  .g8 { background: #B3EE3A; }
  .g9 { background: #d1c0a5; }
  .g10 { background: #7CCD7C; }
  .m { font-weight: bolder; font-size:26px; }
  table {
  margin: 0px auto;
  height: 90vh;
  width: 100%;
  min-width: 1000px;
  }
  td {
  width: 120px;
  text-align: center;
  font-size: 24px;
  font-weight:500;
  text-shadow: 1px 1px 5px #ddd;
  line-height: 40pt;
  border-radius: 5px;
  }
  td:not(.gundefined):hover {
  cursor: crosshair;
  background-color: #00EEEE;
  font-size: 26px;
  font-weight: bold;
  color: red;
  }
  .btngroup {
  display: flex;
  flex-flow: row nowrap;
  justify-content: space-between;
  width: 60%;
  float:right;
  height: 10vh;
  padding: 4px 0;
  }
  .btngroup button {
  color: white;
  background-color: #5CACEE;
  font-size: 18px;
  margin-left: 3px;
  border: 0px;
  height: 100%;
  width: 7em;
  }
  .btngroup button:hover {
  cursor: pointer;
  outline: 0px;
  }
  .btngroup > h3 {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  width: 30%;
  background-color: #ddd;
  }
  #note {
  height: 100%;
  width: 100%;
  background-color: rgba(0,0,0,0.5);
  position: fixed;
  top: 0;
  z-index: 2;
  display: none;
  }
  </style>
  </head>
   
  <body>
  <!-- main table -->
  <table id="main"></table>
   
  <!-- button group -->
  <div class="btngroup">
  <h3>讲台</h3>
  <div>
  <button id="luckygo"></button>
  <button id="notebtn">记事本</button>
  </div>
  </div>
   
  <!-- copyright -->
  <div style="position:absolute;width:50%;bottom:20px;z-index:2;font-size:2px;text-align:left;color:#C9C9C9">暴走猪头统一商标&nbsp;版本号:1.3</div>
   
  <!-- note layer -->
  <div id="note">
  <div style="height:300px; width:600px; background-color:#FFFFFF; margin:60px auto">
  <div style=" background-color:#0099FF; color:#FFFFFF; font-size:24px; padding:20px">记事本</div>
  <div id="ji" style=" padding-top:10px; padding-left:20px; height:70px;background-color:#CCCCCC; color:#FFFFFF"></div>
  <textarea id="text" style="height:80px; width:100%; font-size:18px;" placeholder="输入内容后,失去焦点即保存......"></textarea>
  <button id="prev" style=" height:50px; width:90%; margin:10px 30px; background-color:#0099FF; color:#FFFFFF; border:0px;">退出</button>
  </div>
  </div>
   
  <script>
 
  /* 页面绘制 */
  const all = [
  "aaa/5", "bbb/4", "ccc/1/", "ddd/1","eee/10", "","fff/7/", "jjj/7",
  "hh/5", "", "adf/2/", "asd/1","hhe2", "nfds/2", "bvf/7", "dff/7",
  "dhg/6", "gfd/3", "dhgf/1", "dgf/1","nbvb/10/", " fgd/10","fgd/6", "hghj/5/",
  "shsf/5", "dghf/3", "nbg/3", "jfgd/3","fgs/3", "dgf/10","mds/6", "sfd/6/",
  "dgh/4", "sdf/4", "mfd/3/", "gffgd/2","dfgh/9", "sgfd/9","tsr/8", "dfg/8",
  "dgh/4/", "gfgh/4", "dgf/9", "","dhgf/9", "dgf/9/","dgf/8", "dfhf/8/",
  "trgfh/10", "", "dgfh/5", "","gfdg/6", "","ghdg/7", "dghdf/8",
  ].reverse(), cols = 8;
 
  let result = [];
  for(const [i, s] of all.entries()) {
  let sarr = s.split("/"), name = sarr[0];
  let styleClass = "g" + sarr[1] + (sarr.length > 2 ? " m" : "");
 
  if(i % cols == 0) result.push("<tr>");
  result.push(` <td class='${styleClass}'>${name}</td>`);
  if(i % cols == cols-1 && i != all.length) result.push("</tr>");
  }
  main.innerHTML = result.join("\n");
 
  console.log(main.innerHTML);
 
 
 
  /* 随机抽取 */
  const beginLabel = "抽奖", stopLabel = "停止", interval = 30;
  let timer, current, nodes = Array.from(document.querySelectorAll("td:not(.gundefined)"));
 
  luckygo.innerText = beginLabel;
 
  luckygo.addEventListener("click", function (e) {
  if(nodes.length < 2) {
  window.location.reload();
  } else if (this.innerText == beginLabel) {
  this.innerText = stopLabel;
  timer = setInterval(() => {
  nodes.map(n => n.style.outline = "1px solid white");
  current = nodes[Math.floor(Math.random()*nodes.length)];
  current.style.outline = "1px green solid";
  }, interval);
  } else {
  this.innerText = beginLabel;
  clearInterval(timer);
  nodes = nodes.filter(n => n != current);
  current.style.cssText = "outline: none; background: red; color: white;";
  }
  });
 
  /* 笔记本 */
  notebtn.onclick = function() {
  note.style.display = "block";
  ji.innerText = localStorage.msg;
  }
  text.onblur = function() {
  if(text.value != "") {
  localStorage.msg = text.value;
  ji.innerText = localStorage.msg;
  }
  };
  prev.onclick = function() {
  note.style.display = "none";
  text.value = "";
  text.style.placeholder = "输入内容后,失去焦点即保存......";
  }
 
  </script>
   
   
  </body>
   
  </html>
1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 、4下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合;、下载 4使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合;、 4下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值