如标题:
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <title> Test Date Now </title>
- <script type="text/javascript">
- window.onload = function() {
- var show = document.getElementById("show");
- setInterval(function() {
- var time = new Date(); // 程序计时的月从 0 开始取值后 + 1
- var m = time.getMonth() + 1;
- var t = time.getFullYear() + "-" + m + "-"
- + time.getDate() + "" + time.getHours() +":"+ time.getMinutes() +":" + time.getSeconds();
- show.innerHTML = t;
- //console.info(t);
- }, 1000);
- };
- </script>
- </head>
- <body>
- <div id="show"></div>
- </body>
- </html>
来源: http://www.bubuko.com/infodetail-2525024.html