标签:图片 row body idt array char val date() title
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>获取当前的时间</title> </head> <style> #adata{ height: 30px; width: 330px; border: brown 3px solid; } </style> <body> <div id="adata"></div> </body> </html> <script language="JavaScript" type="text/javascript"> window.onload = function() { window.setInterval("Systime(adata)", 1000); } function Systime(adata) { var now = new Date(); var year = now.getFullYear(); var month = now.getMonth(); var data = now.getDate(); var day = now.getDay(); var hour = now.getHours(); var minu = now.getMinutes(); var sec = now.getSeconds(); month = month + 1; var arr_week = new Array("星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"); var week = arr_week[day]; var time = year + "年 " + month + "月 " + data + "日 " + week + " " + hour + ":" + minu + ":" + sec; adata.innerHTML = "当前时间: " + time; } </script>
标签:图片 row body idt array char val date() title
原文地址:https://www.cnblogs.com/zxrxzw/p/10349245.html