Javascript examples for DOM HTML Element:Time
The Time object represents an HTML <time> element.
You can access a <time> element by using getElementById():
<!DOCTYPE html> <html> <body> <time id="myTime" datetime="2014-02-14">Valentines day</time> <button onclick="myFunction()">get the HTML content of the time element</button> <p id="demo"></p> <script> function myFunction() {//from w w w. java 2s . c om var x = document.getElementById("myTime").innerHTML; document.getElementById("demo").innerHTML = x; } </script> </body> </html>