Не работает добавление класса в строку таблицы карточки в игре "Русское лото онлайн"

Рейтинг: 1Ответов: 0Опубликовано: 19.07.2025

var itemListParent = document.querySelector('.wrappercards');
var itemList = document.querySelectorAll('.itemcard');

window.onload =
  (function() {
    var random_start = 1;
    var random_end = 1;
    allСycles = 1;
    let array1 = [];

    for (i = random_start; i <= random_end; i++) {
      array1.push(i);
    }

    for (countCycles = 1; countCycles <= allСycles; countCycles++) {
      var divNumber = array1.splice(Math.random() * array1.length, 1)[0];
      var elcard = document.getElementById("div" + divNumber);
      itemListParent.insertBefore(itemList[divNumber], itemList[0]);
      if (countCycles == 1) {
        elcard.style.display = 'inline-block';
        elcard.style.margin = '0px 0px 0px 10px';
      }
    }
  });

function shuffle(array) {
  let currentIndex = array.length;
  while (currentIndex != 0) {
    let randomIndex = Math.floor(Math.random() * currentIndex);
    currentIndex--;
    [array[currentIndex], array[randomIndex]] = [
      array[randomIndex], array[currentIndex]
    ];
  }
}
let arrnum = [1];
shuffle(arrnum);
$.each(arrnum, function() {
  $(".numbers").append($("div [data-value=" + this + "]"));
})
let number0 = arrnum[0];
const $elb0 = $("#number" + number0);
setTimeout(function() {
  $elb0.css('display', 'inline-block');
}, 0);

const $1th0 = $("#1num" + number0);

setTimeout(function() {
  $1th0.text("●");
}, 0);

if ($('#1num1').text() == '●') {
  $('#upper1').addClass('marked');
}
.numbers {
  background: #fff2bb;
  width: 460px;
  height: 100px;
  text-align: center;
}

.skipnumbers {
  background: #fff2bb;
  width: 100px;
  height: 100px;
  text-align: center;
  margin-left: 480px;
  margin-top: -100px;
}

.number {
  background: #ffdd00;
  width: 80px;
  height: 80px;
  display: none;
  border-radius: 50%;
  text-align: center;
  margin-top: 10px;
}

b {
  position: absolute;
  font-size: 48px;
  font-family: 'Times New Roman';
  color: black;
  transform: translate(-50%, 5%);
}

.itemcard {
  display: none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<!-- Круги для номеров -->
<div class="numbers">
  <div class="number" id="number1" data-value="1"><b>1</b></div>
</div><br>
<!-- Карточки -->
<div class="container">
  <div class="row">
    <div class="wrappercards">
      <div hidden class="itemcard">Блок 0</div>
      <div class="itemcard" id="div1">
        <table id="card1" bgcolor="black">
          <tr id="upper1">
            <th id="1num1" style="Color: Lime">1</th>
            <th></th>
            <th id="1num27" style="Color: Lime">27</th>
            <th></th>
            <th id="1num43" style="Color: Lime">43</th>
            <th></th>
            <th id="1num61" style="Color: Lime">61</th>
            <th></th>
            <th id="1num89" style="Color: Lime">89</th>
          </tr>
          <tr id="average1">
            <th id="1num7" style="Color: Lime">7</th>
            <th id="1num16" style="Color: Lime">16</th>
            <th></th>
            <th id="1num36" style="Color: Lime">36</th>
            <th></th>
            <th id="1num59" style="Color: Lime">59</th>
            <th id="1num68" style="Color: Lime">68</th>
            <th></th>
            <th></th>
          </tr>
          <tr id="lower1">
            <th></th>
            <th></th>
            <th id="1num28" style="Color: Lime">28</th>
            <th></th>
            <th id="1num49" style="Color: Lime">49</th>
            <th id="1num51" style="Color: Lime">51</th>
            <th></th>
            <th id="1num72" style="Color: Lime">72</th>
            <th id="1num84" style="Color: Lime">84</th>
          </tr>
          <tr>
            <th colspan="9" style="Color: Lime">1</th>
          </tr>
        </table>
      </div>
    </div>
  </div>
</div>

Ответы

Ответов пока нет.