x
 
<!DOCTYPE html>
<html>
<body>
<ol id="myList">
  <li>Tea</li>
  <li>Milk</li>
  <li>Water</li>
</ol>
<p>单击按钮可创建 LI 元素。</p>
<button onclick="myFunction()">试一试</button>
<p id="demo"></p>
<script>
function myFunction() {
  var x = document.createElement("LI");
  var t = document.createTextNode("Coffee");
  x.appendChild(t);
  document.getElementById("myList").appendChild(x);
}
</script>
</body>
</html>