x
 
<!DOCTYPE html>
<html>
<body>
<h3>如何访问 Figure 元素的演示</h3>
<p>郁金香(学名:Tulipa gesneriana)是百合科郁金香属的一个栽培种,又称洋荷花、旱荷花。</p>
<figure id="myFigure">
  <img src="/i/photo/tulip.jpg" alt="The Tulip" width="300" height="300">
</figure>
<p>单击按钮以获取 Figure 元素的 id。</p>
<button onclick="myFunction()">试一试</button>
<p id="demo"></p>
<script>
function myFunction() {
  var x = document.getElementById("myFigure").id;
  document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>