<html>
<body>
<p>单击该按钮以创建一个包含带有一些文本的 P 元素的 FOOTER 元素。</p>
<button onclick="myFunction()">试一试</button>
<script>
function myFunction() {
var x = document.createElement("FOOTER");
x.setAttribute("id", "myFooter");
document.body.appendChild(x);
var y = document.createElement("P");
var t = document.createTextNode("This is a p element in a footer element.");
y.appendChild(t);
document.getElementById("myFooter").appendChild(y);
}
</script>
</body>
</html>