<html>
<head>
<title> 獲取時間日期 </title> </head>
<body> <h2> 獲取時間日期 </h2>
<hr>
<script language="javascript">
var weekday = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
var dttody=new date();
var output=  dttody.getDate() + "/";
output+= (dttody.getMonth() + 1) + "/";
output+= dttody.getFullYear() + "<br>";
document.write("系統日期:" + output);output=dttody.getHours() +":";
output+=dttody.getMinutes() +":";
output+=dttody.getSeconds() +"<br>";document.write("系統時間:" +output);
document.write(weekday[dttoday.getDay()]);
</script>
</body>
</html>
 求指教啊,谢谢

解决方案 »

  1.   

    var dttody = new Date(); date要大写
      

  2.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
        <title>獲取時間日期 </title>
    </head>
    <body>
        <h2>
            獲取時間日期
        </h2>
        <hr>
        <script language="javascript">
            var weekday = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
            var dttody = new Date();
            var output = dttody.getDate() + "/";
            output += (dttody.getMonth() + 1) + "/";
            output += dttody.getFullYear() + "<br>";
            document.write("系統日期:" + output);        output = dttody.getHours() + ":";
            output += dttody.getMinutes() + ":";
            output += dttody.getSeconds() + "<br>";        document.write("系統時間:" + output);
            document.write(weekday[dttody.getDay()]);
        </script>
    </body>
    </html>
      

  3.   

    javascript中的内部代码构造函数都以大写开头的