x
 
<!DOCTYPE html>
<html>
<body>
<p>单击该按钮以创建带有一些文本的 FIGCAPTION 元素。</p>
<button onclick="myFunction()">试一试</button><br><br>
<figure id="myFigure">
  <img src="/i/photo/tulip.jpg" alt="The Tulip" width="300" height="300">
</figure>
<script>
function myFunction() {
  var x = document.createElement("FIGCAPTION");
  var t = document.createTextNode("Fig.1 - 郁金香是百合科郁金香属的一个栽培种,又称洋荷花、旱荷花。");
  x.appendChild(t);
 
  var y = document.getElementById("myFigure");
  y.appendChild(x);
}
</script>
</body>
</html>