<html>
<body>
<p>单击该按钮以创建 UL 和 LI 元素。</p>
<button onclick="myFunction()">试一试</button>
<script>
function myFunction() {
var x = document.createElement("UL");
x.setAttribute("id", "myUL");
document.body.appendChild(x);
var y = document.createElement("LI");
var t = document.createTextNode("Tea");
y.appendChild(t);
document.getElementById("myUL").appendChild(y);
}
</script>
</body>
</html>