Javascript examples for DOM HTML Element:Time
You can create a <time> element by using the document.createElement() method:
<!DOCTYPE html> <html> <head> </head>//from w w w.j a v a2s.c om <body> <button onclick="myFunction()">create a TIME element</button> <script> function myFunction() { var x = document.createElement("TIME"); x.setAttribute("datetime", "2014-02-14"); var t = document.createTextNode("Valentines day"); x.appendChild(t); document.body.appendChild(x); } </script> </body> </html>