检测页面已经制作完成的时间

王朝other·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

有什么问题请到<a href='/bbs/forums.php?fid=21'>论坛</a>中发表<br>

<!-- http://www.webjx.com/js -->

<!-- bbs http://bbs.webjx.com -->

<!--脚本说明:

把如下代码加入<body>区域中:

-->

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

function HowLongSince(startmonth, startdate, startyear) {

sdate=startdate;

smonth=startmonth-1;

syear=startyear;

var DaysInMonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31);

today = new Date()

var thisyear = today.getFullYear();

var thismonth = today.getMonth();

var thisdate = today.getDate();

mstart = new Date(syear,(smonth==12?1:smonth+1),1);

days1 = (mstart - new Date(syear,smonth,sdate))/(24*60*60*1000)-1;

mend = new Date(thisyear,thismonth,1);

days2 = (new Date(thisyear,thismonth,thisdate) - mend)/(24*60*60*1000)+1;

dayst = days1 + days2;

if (dayst >= DaysInMonth[smonth]) {

AddOneMonth = 1;

dayst -= DaysInMonth[smonth];

}

else AddOneMonth = 0;

ydiff1 = thisyear-mstart.getFullYear();

mdiff1 = thismonth-mstart.getMonth()+AddOneMonth;

if (mdiff1 >11) { mdiff1=0; ydiff1++; }

if (mdiff1 < 0) { mdiff1 = mdiff1 + 12; ydiff1--; }

temp = (ydiff1==0?"":(ydiff1==1?ydiff1+" year and ":ydiff1 + " years, "));

temp += (mdiff1==0?"0 months, and ":(mdiff1==1?mdiff1+" month, and ":mdiff1+" months, and "));

temp += (dayst==0?"no days":(dayst==1 ? " 1 day." : dayst + " days" ));

return temp;

}

// End -->

</script>

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

document.write("本页面已经制作完成:");

document.write("<font color=red>");

document.write(HowLongSince(06,29,2004));

// this is the date your site was created. day,month,year

document.write("</font>了");

// End -->

</script>

[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航