双色球单选代码

双色球单选代码

<html>
  <head>
    <title>Kill Number Tool</title>
    <style>
      body {
        width: 375px;
        height: 667px;
      }
      /* button {
        width: 300%;
        height: 100px;
        font-size: 50px;
      } */
      .row {
        width: 700px;
        display: flex;
      }
      #red {
        width: 420px;
      }
      #blue {
        width: 420px;
      }
      .ball {
        width: 38px;
        display: inline-block;
        border: 1px solid gray;
        border-radius: 50%;
        line-height: 40px;
        text-align: center;
        margin:10px;
      }
      .redBall {
        background-color: red;
        color: #fff;
      }
      .blueBall{
        background-color: rgb(110, 185, 235);
        color: #fff;
      }
      #a36select7{
        width: 100px;
        height: 20px;
      }
    </style>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  </head>
  <body>
    <h1>Kill Number Tool</h1>
    <button id="a36select7">36 Select 7</button>
    <div id="red"></div>
    <div id="blue"></div>
    <div id="result"></div>
    <script>
      const button36 = document.getElementById("a36select7");
      button36.addEventListener("click", function () {
        let numbers = [];
        while (numbers.length < 7) {
          let number = Math.floor(Math.random() * 33) + 1;
          if (!numbers.includes(number)) {
            numbers.push(number);
          }
        }
        let special = Math.floor(Math.random() * 16) + 1;
        let data = Array(33);
        let html = "";
        $.each(data, function (index, value) {
          html += `<div class="ball ${
            numbers.indexOf(index + 1) > 0 ? "redBall" : ""
          }">${index + 1}</div>`;
        });
        $("#red").html(html);
        let data2 = Array(16);
        let html2 = "";
        $.each(data2, function (index, value) {
          html2 += `<div class="ball ${
            special===index + 1 ? "blueBall" : ""
          }">${index + 1}</div>`;
        });
        $("#blue").html(html2);
      });
    </script>
  </body>
</html>

在这里插入代码片

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值