Показать сообщение отдельно
  #2 (permalink)  
Старый 08.05.2020, 00:25
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,070

фейковая таблица выигрышей
CORONER,
<!DOCTYPE html>
<html>
<head>
    <title>Untitled</title>
    <meta charset="utf-8">
    <style type="text/css">
    tbody {
        counter-reset: n 30;
    }

    tbody tr :nth-child(2)  {
            color: #FF0000;
            font-weight: bold;
    }
    tbody tr :nth-child(1):before{
     content: counter(n)" секунд назад";
    counter-increment: n 15;
    }
    </style>

</head>
<body>
<table>
<tbody></tbody>
</table>

<script>
(async function up() {
    const response = await fetch("https://cors-anywhere.herokuapp.com/http://randomuser.ru/api.json")
    const resArr = await response.json();
        let {last, first} = resArr[0].user.name;
        let tr = `<tr><td></td><td>${last} ${first}</td><td>${2000 + Math.trunc(Math.random() * 10000)}</td></tr>`
        const tbody = document.querySelector('table tbody');
        if(tbody.rows.length == 5) tbody.rows[4].remove();
        tbody.insertAdjacentHTML('afterBegin', tr);
        window.setTimeout(up, 3000);
})();

    </script>
</body>
</html>
Ответить с цитированием