<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <script> window.onload=function(){ var a=new Date(); //向id为a的p中输出时间 //document.getElementById("a").innerHTML=a; //向当前文档输出时间 document.write(a); } </script> </head> <body> <p id="a"></p> </body> </html>
The above is the detailed content of How to output time in html document/specified tag. For more information, please follow other related articles on the PHP Chinese website!