运行 ❯
获取您的
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
转到 Spaces
<!DOCTYPE html> <html> <body> <h3>A demonstration of how to access a TIME element</h3> <p>I have a date on <time id="myTime" datetime="2014-02-14">Valentines day</time>.</p> <p>Click the button to get the HTML content of the time element above.</p> <button onclick="myFunction()">Try it</button> <p><b>Note:</b> The time element does not render as anything special in any of the major browsers.</p> <p><b>Note:</b> The dateTime property is only supported in Firefox and Opera 12.</p> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myTime").innerHTML; document.getElementById("demo").innerHTML = x; } </script> </body> </html>