设为首页 加入收藏
当前位置:首页 > 整站内容 > 特效代码 > 时间日期 > 详细内容
生日提醒器
发布时间:2010-1-20  阅读次数:10145  字体大小: 【】 【】【

<html>
<head>
<title>网页特效|Linkweb.cn/Js|---生日提醒器</title>
<style type="text/css">
<!--
body {   font-family: "宋体"; font-size: 9pt; margin-top: 0px; margin-left: 0px; margin-right: 0px}
A { COLOR: black; FONT-SIZE: 9pt; FONT-WEIGHT: 400; TEXT-DECORATION: none }
  A:hover { COLOR: red; FONT-SIZE: 9pt; FONT-WEIGHT: 400; TEXT-DECORATION: underline }
a:active         { font: 9pt "宋体"; cursor: hand; color: #FF0033 }

-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<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[0]= new birthday(84,1,16,"Matthew")

   blist[1]= new birthday(53,1,27,"Brenda")

   blist[2]= new birthday(77,7,10,"陆晓庆")

   blist[3]= new birthday(88,4,27,"Michael")

   blist[4]= new birthday(86,9,2,"Andrew")

   blist[5]= new birthday(49,11,24,"Raymond")

   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[i].month,list[i].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[closest].person+" became "+(today.getYear()-list[closest].year)+" years old !! Hoorah!</B><P>")

       else if (daysToClosest==1)

           document.write("So tomorrow "+list[closest].person+" will become "+(today.getYear()-list[closest].year)+" !<P>")

       else

           document.write("你最近要过生日的朋友是 "+list[closest].person+", 在 "+daysToClosest+" 天后.<P>")

   }

              

// end hiding -->

  

</SCRIPT>
</head>

<body>
<br>
<br>
<center><font color=red face="隶书" size=6>生日提醒器</font></center>
<br>
<center>
<table border=0 bordercolor=blue borderlight=green style="border-collapse: collapse" cellpadding="0" cellspacing="0">
<tr><td align=center><font size=5 color=red face="Arial, Helvetica, sans-serif"><strong>下面为效果显示区!</strong></font></td></tr>
<tr><td align=center>
<SCRIPT LANGUAGE="JavaScript">
<!--  

   writeNextBirthday(blist)

// -->
</SCRIPT>
</td></tr></table></center>
<br>
<br>
<center>
&nbsp;<SCRIPT LANGUAGE="JavaScript">

<!-- hide

function goHist(a)

{

     history.go(a);

}

//-->

</script></center>
<br>
<br>
</body>
</html>

预览效果

天猫商城    聚划算    天猫电器城    淘宝旅行    天猫超市    淘宝游戏    天猫品牌特卖    天猫母婴

我要评论
  • 匿名发表
  • [添加到收藏夹]
  • 发表评论:(匿名发表无需登录,已登录用户可直接发表。) 登录状态:未登录
最新评论
所有评论[0]
    暂无已审核评论!

全站链接: 
收录查询
分享按钮