x
 
<!DOCTYPE html>
<html>
<body>
<h1>演示如何访问 TIME 元素</h1>
<p>我在<time id="myTime" datetime="2023-08-22">七夕节</time>有一个约会。</p>
<p>点击按钮可得到上面 time 元素的 HTML 内容。</p>
<button onclick="myFunction()">试一试</button>
<p><b>注释:</b>time 元素在任何主要浏览器中都不会呈现为任何特殊内容。</p>
<p><b>注释:</b>dateTime 属性仅在 Firefox 和 Opera 12 中受支持。</p>
<p id="demo"></p>
<script>
function myFunction() {
  var x = document.getElementById("myTime").innerHTML;
  document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>