<html>
  <head>
    <title>Guess the Number Game</title>
    <script type='text/javascript'>
      var randomNumber = Math.floor(Math.random() * 10) + 1;
      var guess = prompt('Guess a number between 1 and 10');
      if (parseInt(guess) === randomNumber) {
        document.write('You guessed the number!');
      } else {
        document.write('Sorry, the number was ' + randomNumber);
      }
    </script>
  </head>
  <body>
  </body>
</html>
Simple HTML Guessing Game: Code and Tutorial

原文地址: https://www.cveoy.top/t/topic/lmjW 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录