Date 日期对象
定义一个时间对象
var date=new Date()//显示当前电脑的日期
var d=new Date(2012,10,1);// 定义一个日期。
var d=new Date(2012,10,1);// 定义一个日期。
反回星期的方法:
getDay() 返回星期,返回的是0-6的数字,0 表示星期天
<script type="text/javascript">
var mydate=new Date();
var weekday=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
var mynum=mydate.getDay();
document.write(mydate.getDay());
document.write(weekday[mynum])
</script>
var mydate=new Date();
var weekday=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
var mynum=mydate.getDay();
document.write(mydate.getDay());
document.write(weekday[mynum])
</script>