代码1:(显示静态时间)<scripttype="text/j**ascript">var mydate = new date();document.write(mydate.tolocalestring())</script>(动态显示系统时间)<html><head><meta charset="utf-8"><title>html显示时间</title><meta http-equiv="content=type"content="text/html"></head><script>function show(){var date = new date(); //日期对象var now = "";now = date.getfullyear()+"年"; //读英文就行了now = now + (date.getmonth()+1)+"月";//取月的时候取的是当前月-1如果想取当前月+1就可以了now = now + date.getdate()+"日";now = now + date.gethours()+"时";now = now + date.getminutes()+"分";now = now + date.getseconds()+"秒";document.getelementbyidx_x("nowdiv").innerhtml =now; //div的html是now这个字符串settimeout("show()",1000);//设置过1000毫秒就是1秒,调用show方法}</script><body onload="show()"><!-- 网页加载时调用一次 以后就自动调用了--><divid="nowdiv"></div></body></html> 20210311