<!DOCTYPE html>
<html>
<head>
  <title>Basketball Game</title>
  <script>
  // Start the game
  var score = 0;
  // Player clicks the basket
  function basketClicked(){
    score = score + 1;
    document.getElementById('score').innerHTML = score;
  }
  </script>
</head>
<body>
  <h1>Basketball Game</h1>
  <div onclick='basketClicked()' style='height:100px; width:100px; background-color:orange;'></div>
  <br>
  <h2>Score: <span id='score'>0</span></h2>
</body>
</html>
Simple JavaScript Basketball Game - Click to Score

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

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