宝宝成长天数统计
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>
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>
相关文章推荐
- Python小程序:统计宿舍成员入住天数
- 宝宝的成长脚印5/28
- 宝宝两岁半成长盘点
- 漫说单例模式--宝宝成长记 你真的了解了吗?
- 宝宝牙齿成长!
- 漫说单例模式--宝宝成长记 你真的了解了吗?
- 统计天数
- 缺勤天数统计的处理示例.sql
- 宝宝的成长脚印8/17
- 宝宝的成长脚印8/27
- 编写SQL Server函数统计两日期间的工作日天数
- 洛谷P1567 统计天数
- 统计出生天数(改进前)
- Java统计两个日期时间段每个月对应的天数
- 宝宝的成长脚印3/20
- 统计闰年2月29日天数
- 几张关于IT业人才成长的统计图片
- ASP.NET 统计连续签到天数
- SQL按日期天数(即 每日)合并统计项
- 添加 Z-Blog 博客运行天数统计效果