您的位置:首页 > 其它

宝宝成长天数统计

2013-04-06 10:00 190 查看
<script language=”JavaScript” type=”text/javascript”>

now = new Date()

nowyear=now.getFullYear()

if(nowyear<2000)

nowyear=nowyear+1900

nowmonth=now.getMonth()+1

nowdate=now.getDate()

years=nowyear-2011 //2011改成宝宝生日那年

months=nowmonth-06 //06改成宝宝生日那月

dates=nowdate-19 //19改成宝宝生日那天

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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: