有什么问题请到<a href='/bbs/forums.php?fid=21'>论坛</a>中发表<br>
脚本说明:<br>
<!-- 把如下代码加入<body>区域中 -->
<!-- http://www.webjx.com/js -->
<!-- bbs http://bbs.webjx.com -->
看看效果怎么样啊:<br>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function isLeapYear () {
year = new Date().getYear();
year += (year < 2000 ? 1900 : 0);
return (year % 4==0 && year % 100!=0 || year % 400==0);
}
function formatDate(date) {
mymonth = date.getMonth()+1;
myweekday = date.getDate();
return (mymonth + "/" + myweekday);
}
function printWeek() {
beginday = 0; // first day of each week
// 0 = sunday, 1= monday .... 6 = saturday
var dayarray = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
dayarray[1] = (isLeapYear()) ? 29 : 28;
dayfactor = 86400000; // one day equals 86400000 milliseconds
weekstart = new Date();
weekend = new Date();
while (weekstart.getDay() != beginday) {
weekstart.setTime(weekstart.getTime() - dayfactor);
}
weekend.setTime(weekend.getTime() + 6*dayfactor);
document.write("最近两个星期天为: " + formatDate(weekstart) + " - " + formatDate(weekend));
}
// End -->
</script>
<script>
printWeek();
</script>
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]