***时间日期***检测最近两个星期天的日期(当然也可以是其它星期)
把下列代码加到网页的<body></body>标签之间 从google下载我的照片管理软件要完成此效果把如下代码加入到<body>区域中
<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 = (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>
--------------------------------------
拥有三人行论坛管理系列软件,一个人就可以管理一个论坛的更新维护。还能使您的论坛有千人在线的真实火暴效果,让您不在为论坛因没有人气而留不住会员而烦恼,使您的论坛早日成为一流的论坛。详情请登陆网站:http://www.cnsrx.cn 三人行论坛管理软件,站长必备的专业好工具。(您使用的是免费版本,购买收费版本后,将不带广告。业务QQ:247216 44985227)
页:
[1]