Jump to content

Crazy54789

Neophyte
  • Posts

    2
  • Joined

  • Last visited

Information

  • Sex
    мужской
  • From
    Ukraine

Crazy54789's Achievements

Explorer

Explorer (1/14)

  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. function showModal(id) { document.getElementsByClassName(`modal-1`)[0].classList.add('active') } function closeGame(id) { document.getElementsByClassName(`modal-1`)[0].classList.remove('active') } function getRandomImage() { var imgArray = ['<img src="img/0.jpg" alt="#" />', '<img src="img/1.jpg" alt="#" />', '<img src="img/2.jpg" alt="#" />', '<img src="img/3.jpg" alt="#" />', '<img src="img/4.jpg" alt="#" />', '<img src="img/5.jpg" alt="#" />', '<img src="img/6.jpg" alt="#" />', '<img src="img/7.jpg" alt="#" />', '<img src="img/8.jpg" alt="#" />', '<img src="img/9.jpg" alt="#" />', '<img src="img/10.jpg" alt="#" />']; var rand = Math.floor(Math.random() * imgArray.length); var randImg = imgArray[rand]; var imgTag = document.getElementById('img'); imgTag.innerHTML = randImg; } window.onload = getRandomImage; Вот здесь выдает ошибку в строке imgTag.innnerHTML = randImg; HTML код <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Lr_8</title> <link rel="stylesheet" href="style.css"> </head> <body> <input class="player-name" value ="Print your nickname..."></input> <button class="play" onclick="showModal(1)">Play</button> <div class="modal modal-1"> <div class="modal-window"> <div class="modal-header"> <h4 class="title">Lr_8</h4> <div class="close" onclick="closeGame(1)">&times;</div> </div> <div class="modal-body"> <div class="img_"> <div class="img img-player"></div> <div class="img img-enemy"></div> </div> <div class="nickname"> <output class="player"></output> <output class="enemy"></output> </div> <div class="point_"> <div class="point point-player"></div> <div class="point point-enemy"></div> </div> <div class="number_"> <div class="number number-player"></div> <div class="number number-enemy"></div> </div> <div class="number_"> <button class="generate" onclick="generateNum()"></button> </div> </div> </div> </div> </div> </div> </body> <script src="script.js"></script> </html> Я студент, только учусь вебу возможно код кривой ехех
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy