Result Size: 625 x 534
x
 
<!DOCTYPE html>
<html>
<body>
<p>我在考虑一字母。 猜猜哪个:a、b、c、d 或 e?</p>
<input id="myInput" type="text">
<button onclick="myFunction()">试一试</button>
<p id="demo"></p>
<script>
function myFunction() {
  var letter = document.getElementById("myInput").value;
  var text;
  // 如果字母是 "c"
  if (letter === "c") {
    text = "Spot on! Good job!";
    
  // 如果字母是 "b" 或 "d"
  } else if (letter === "b" || letter === "d") {
    text = "Close, but not close enough.";
    
  // 如果字母是其他任何
  } else {
    text = "Waaay off..";
  }
  document.getElementById("demo").innerHTML = text;
}
</script>
</body>
</html>