请原谅我日渐衰退的记忆,真的不记得了,某日在某位博主的博客看到有个年龄计时器,很简单,只是显示宝贝的年龄,格式如下:
于是跟博主要了来,后来又借花献佛转发给几位妈妈,索性放到这里,或许有用?
虽然代码很长,但使用很简单,复制代码后将红色字体部分改成自己宝宝的数据,然后复制粘贴到博客后台的‘博客设置’--‘首页公告’位置,提交就可以了。
代码全文如下:
<h2>凡屁屁成長計時</h2>
<div align="center">
<script language="--BLOCKED--">
today=new Date();
function initArray(){
this.length=initArray.arguments.length
for(var i=0;i<this.length;i++)
this[i+1]=initArray.arguments[i] }
var d=new initArray(
"星期日",
"星期一",
"星期二",
"星期三",
"星期四",
"星期五",
"星期六");
document.write(
"<font style='font-size:9pt;font-family: 宋体'>今天是",
today.getFullYear(),"年",
today.getMonth()+1,"月",
today.getDate(),"日",
d[today.getDay()+1],
"</font>" );
</script>
</div>
<div align="center">
<script language="--BLOCKED--" type="text/--BLOCKED--">
<!--
now = new Date()
nowyear=now.getFullYear()
if(nowyear<2000)
nowyear=nowyear+1900
nowmonth=now.getMonth()+1
nowdate=now.getDate()
years=nowyear-2006
months=nowmonth-04
dates=nowdate-16
if((years<0)||((years==0)&&(months<0))||((years==0)&&(months==0)&&(dates<=0)))
document.write("<span><font color=red>你的系统时钟好像不太对哦!</font></span>")
else {
if(dates<0) {
months=months-1
dates=dates+30
}
if(months<0) {
years=years-1
months=months+12
}
document.write("<span>凡屁屁已经")
if (years>0) {
document.write(years)
document.write("岁")
}
if(months>0) {
document.write(months)
document.write("个月")
}
if(((years>0)||(months>0))&&(dates>0))
document.write("零")
if(dates>0) {
document.write(dates)
document.write("天")
}
else
document.write("整")
document.write("啦</span>")
if((months==0)&&(dates==0)) {
document.write("<span>!<font color=red><b>凡屁屁生日快乐!")
document.write("</b></font></span>")
}
}
//-->
</script></div>
<p align="center"><font color="#6b6b36">(<script language="--BLOCKED--">
<!--
var urodz = new Date("April 16,2006");
var now = new Date();
var ile = now.getTime() - urodz.getTime();
var dni = Math.floor(ile / (1000 * 60 * 60 * 24));
if (dni > 0)
document.write("<font color=ff6500><b>" + dni + "</b></font>days")
else
document.write("This will happen in future");
// --></script><font color="ff6500"><b></b></font>) </font></p>
此帖已经被版主李家熙熙奖励积分20分。