<html>
  <head>
    <title>I Spy Game</title>
  </head>
  <body>
    <h1>I Spy Game</h1>
    <div>
      <p>I spy something with my little eye. What do you see?</p>
      <input type='text' id='guess' placeholder='Enter your guess'>
      <button type='button' onclick='checkGuess()'>Check Guess</button>
    </div>
    <div id='result'></div>
    <script>
      function checkGuess() {
        let guess = document.getElementById('guess').value;
        let resultElement = document.getElementById('result');
        if (guess === 'blue') {
          resultElement.innerHTML = 'You got it right!';
        } else {
          resultElement.innerHTML = 'Sorry, wrong guess!';
        }
      }
    </script>
  </body>
</html>
I Spy Game: Online HTML Code for Fun

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

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