x
 
<!DOCTYPE html>
<html>
<body>
<p>单击该按钮以创建带有一些文本的 CODE 元素。</p>
<button onclick="myFunction()">试一试</button>
<br><br>
<script>
function myFunction() {
  var x = document.createElement("CODE");
  var t = document.createTextNode("A piece of computer code");
  x.appendChild(t);
  document.body.appendChild(x);
}
</script>
</body>
</html>