<html>
  <head>
    <title>RPG Game</title>
  </head>
  <body>
  <h1>RPG Game</h1>
  <div>
    <p>Welcome to the RPG game! Choose your hero:</p>
    <div class='hero-choices'>
      <button>Fighter</button>
      <button>Mage</button>
      <button>Thief</button>
    </div>
  </div>
  <script>
    let heroChoices = document.querySelector('.hero-choices');
    heroChoices.addEventListener('click', (e) => {
      console.log(e.target.innerText);
    });
  </script>
  </body>
</html>
Create Your Own RPG Game: HTML Tutorial

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

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