求解 jsp一问
程序代码:
<html> <head> <title> date </title> <style> div{ margin-left:16%; padding-top:16%; width:1000px; height:400px; font-size:100px; color:336699; font-family:Gulim; display:block; } </style> <script type="text/javascript"> function timedCount(){ var d=new Date(); var y=d.getYear(); var m=d.getMonth(); var d=d.getDay(); var h=d.getHours(); var m=d.getMinutes(); var s=d.getSeconds() m = judge(m); d = judge(d); h = judge(h); m = judge(m); s = judge(s); divdate.innerHTML=y+"-"+m+"-"+d+" "+h+":"+m+":"+s; var timer = setTimeout("timedCount()",1000) } function judge(a){ if(a<10){ a="0"+a; } return a; } </script> </head> <body onload="timedCount()"> <form> <div id="divdate"></div> </form> </body> </html>以上运行时提示:var h=d.getHours();var m=d.getMinutes();var s=d.getSeconds()没有该方法或属性。
另外,将该三行注释,并且只输出日期,与系统时间不符合 2010-05-14 输出为2010-04-05
求解~~~~~