***时间日期***是多个事件发生的倒计时提醒牌 (做朋友的生日提示最佳啊!!!)
把下列代码加到网页的<body></body>标签之间 从google下载我的照片管理软件要完成此效果需要两个步骤
第一步:把如下代码加入到<head>区域中
<script language="javascript">
<!--
function birthday(year,month,date,person) {
this.year=year
this.month=month
this.date=date
this.person=person
}
function birthdaylist() {
}
blist=new birthdaylist()
blist= new birthday(82,6,29,"张三")
blist= new birthday(79,3,4,"李四")
blist= new birthday(81,4,7,"王五")
blist= new birthday(82,5,23,"赵六")
blist= new birthday(76,9,11,"沈七")
blist= new birthday(80,11,12,"马八")
var now=new date()
today=new date(now.getyear(),now.getmonth(),now.getdate()) // today 0:00:00
function daysfromtoday(sdate) {
return math.round((sdate.gettime()-today.gettime())/(24*60*60*1000))
}
function writenextbirthday(list) {
var daystoclosest=888
var closest
for (var i in list) {
thisdate=new date(today.getyear(),list.month,list.date)
if (daysfromtoday(thisdate)<0)
thisdate.setyear(today.getyear()+1)
if (daysfromtoday(thisdate)<daystoclosest) {
daystoclosest=daysfromtoday(thisdate)
closest=i
}
}
if (daystoclosest==0)
document.write("<b>so today "+list.person+" became
"+(today.getyear()-list.year)+" years old !! hoorah!</b><p>")
else if (daystoclosest==1)
document.write("so tomorrow "+list.person+" will become
"+(today.getyear()-list.year)+" !<p>")
else
document.write("今天,距离"+list.person+"的生日还有 "+daystoclosest+" 天.<p>")
}
// end hiding -->
</script>
第二步:把如下代码加入到<body>区域中
<script language="javascript">
<!--
writenextbirthday(blist)
// -->
</script>
--------------------------------------
拥有三人行论坛管理系列软件,一个人就可以管理一个论坛的更新维护。还能使您的论坛有千人在线的真实火暴效果,让您不在为论坛因没有人气而留不住会员而烦恼,使您的论坛早日成为一流的论坛。详情请登陆网站:http://www.cnsrx.cn 三人行论坛管理软件,站长必备的专业好工具。(您使用的是免费版本,购买收费版本后,将不带广告。业务QQ:247216 44985227)
页:
[1]