<html>
<body>
<p>单击该按钮来创建一个包含 IMG 元素的 Figure 元素。</p>
<button onclick="myFunction()">试一试</button><br><br>
<script>
function myFunction() {
var x = document.createElement("FIGURE");
x.setAttribute("id", "myFigure");
document.body.appendChild(x);
var y = document.createElement("IMG");
y.setAttribute("src", "/i/photo/tulip.jpg");
y.setAttribute("width", "300");
y.setAttribute("width", "300");
y.setAttribute("alt", "The Tulip");
x.appendChild(y);
}
</script>
</body>
</html>