<html>
<body>
<p>单击按钮创建 SPAN 元素。</p>
<button onclick="myFunction()">试一试</button>
<script>
function myFunction() {
var x = document.createElement("SPAN");
var t = document.createTextNode("这是一个 span 元素。");
x.appendChild(t);
document.body.appendChild(x);
}
</script>
</body>
</html>