| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 748 人关注过本帖
标题:关于网上找到的一段生日提醒源码怎么用
只看楼主 加入收藏
wispyer
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2012-5-13
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:6 
关于网上找到的一段生日提醒源码怎么用
首先申明我是小白,基本不动编程,谢谢!
网上找了下边这段源码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>同学生日提醒</TITLE>
<STYLE type=text/CSS>BODY {
FONT-FAMILY: "宋体"; FONT-SIZE: 9pt; MARGIN-LEFT: 0px; MARGIN-RIGHT: 0px; MARGIN-TOP: 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 {
COLOR: #ff0033; CURSOR: hand; FONT: 9pt "宋体"
}
</STYLE>

<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<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(1933,2,14,"abc")
  blist[1]= new birthday(1933,12,17,"efs")
  //上面添加你朋友的生日列表
  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-1,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>今天["+list[closest].person+"]"+"["+(today.getYear()-list[closest].year)+"]岁大寿!
祝你生日快乐^0^</B>")
    else if (daysToClosest==1)
      document.write("明天["+list[closest].person+"]将过["+(today.getYear()-list[closest].year)+"]岁生日!")
    else
      document.write("你最近要过生日的朋友是["+list[closest].person+"]在["+daysToClosest+"]天后。")
      }
// end hiding -->
</SCRIPT>
<META content="MSHTML 5.00.2614.3500" name=GENERATOR></HEAD>
<BODY onLoad="startclock ()" bgColor=#FFFFFF>
<CENTER>
  <font color="red"><font color="#FF3333" size="5">同学生日提醒</font></font><FONT color=red face=隶书
size=6><br>
  </FONT> <FONT color=red face=隶书 size=6> </FONT>
</CENTER>
<div align="center">
  <hr size="1" color="#000000" noshade>
  现在的日期时间是:
<script language=Javascript>
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 color=##000000 style='font-size:9pt;font-family: 宋体'> ",
today.getYear(),"年",
today.getMonth()+1,"月",
today.getDate(),"日",
d[today.getDay()+1],
"</font>" );
</script>
  <br>
  <br>
</div>
<CENTER>
  <table width="502" border="1" cellspacing="0" cellpadding="0" bordercolordark="#FFFFFF"
bordercolor="#000000">
    <tr bgcolor="#CCFFCC">
      <td>
        <div align="center"><font color="#FF3333"></font><font color="#FF3333" size="4">大
          家 注 意 了</font></div>
      </td>
    </tr>
    <tr>
      <td>
        <div align="center">
          <script language=JavaScript>
<!--  
  writeNextBirthday(blist)
// -->
</script>
        </div>
      </td>
    </tr>
  </table>
  <br>
  ---97计算机---
</CENTER>
</BODY></HTML>


资料引用:http://www.

我是要在单位的内部局域网使用的,我将这段源码放进frontpag当中,在blist[1]= new birthday(1933,12,17,"efs")
下边按照格式添加了许多人,特意有几个设成这两天的,然后存成asp格式,上传到服务器,用ie打开这个文件,却只能显示当前的时间,再就是显示大家注意啦这几个字,其他的一概不显示,根本不显示过生日的人,请问问题在哪里,我看网上这段源码挺流行,应该不会有问题吧,是我不会使用吗??
搜索更多相关主题的帖子: 生日 网上 PUBLIC active black 
2012-05-13 17:26
wispyer
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2012-5-13
收藏
得分:0 
没有人吗,自己顶
2012-05-13 19:58
wispyer
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2012-5-13
收藏
得分:0 
失望啊,怎么没有人呢,等了几天了!没有人理?
2012-05-14 23:26
wangjy500
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:13
帖 子:457
专家分:2569
注 册:2010-7-11
收藏
得分:20 
程序代码:
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>同学生日提醒</TITLE>
<STYLE type=text/CSS>BODY {
FONT-FAMILY: "宋体"; FONT-SIZE: 9pt; MARGIN-LEFT: 0px; MARGIN-RIGHT: 0px; MARGIN-TOP: 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 {
COLOR: #ff0033; CURSOR: hand; FONT: 9pt "宋体"
}
</STYLE>

<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<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(2011,5,15,"abc");
  blist[1]= new birthday(1979,5,16,"efs");
  blist[2]= new birthday(1979,5,25,"wang");
  blist[3]= new birthday(1985,5,14,"picc");
  //上面添加你朋友的生日列表
  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-1,list[i].date+1)
      if (daysFromToday(thisDate)<0)
        thisDate.setYear(today.getYear()+1)
      if (daysFromToday(thisDate)<daysToClosest) {
        daysToClosest=daysFromToday(thisDate)
        closest=i
      }
   
    if (daysToClosest==0){
      document.write("<B>今天["+list[closest].person+"]"+"["+(today.getYear()-list[closest].year)+" ]岁大寿!祝你生日快乐^0^</B><br/>")
      daysToClosest=888
       }else if (daysToClosest==1){
     document.write("明天["+list[closest].person+"]将过["+(today.getYear()-list[closest].year)+" ]岁生日!<br/>")
     daysToClosest=888
   }else{
      document.write("最近要过生日的朋友是["+list[closest].person+"]在["+(daysToClosest)+" ]天后。<br/>")
      daysToClosest=888
      }
     }
      }
// end hiding -->
</SCRIPT>
<META content="MSHTML 5.00.2614.3500" name=GENERATOR></HEAD>
<BODY onLoad="startclock ()" bgColor=#FFFFFF>
<CENTER>
  <font color="red"><font color="#FF3333" size="5">同学生日提醒</font></font><FONT color=red face=隶书
size=6><br>
  </FONT> <FONT color=red face=隶书 size=6> </FONT>
</CENTER>
<div align="center">
  <hr size="1" color="#000000" noshade>
  现在的日期时间是:
<script language=Javascript>
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 color=##000000 style='font-size:9pt;font-family: 宋体'> ",
today.getYear(),"",
today.getMonth()+1,"",
today.getDate(),"",
d[today.getDay()+1],
"</font>" );
</script>
  <br>
  <br>
</div>
<CENTER>
  <table width="502" border="1" cellspacing="0" cellpadding="0" bordercolordark="#FFFFFF"
bordercolor="#000000">
    <tr bgcolor="#CCFFCC">
      <td>
        <div align="center"><font color="#FF3333"></font><font color="#FF3333" size="4">大
          家 注 意 了</font></div>
      </td>
    </tr>
    <tr>
      <td>
        <div align="center">
          <script language=JavaScript>
<!-- 
  writeNextBirthday(blist)
// -->
</script>
        </div>
      </td>
    </tr>
  </table>
  <br>
  ---97计算机---
</CENTER>
</BODY></HTML>




[ 本帖最后由 wangjy500 于 2012-5-15 19:20 编辑 ]

QQ:63572063
2012-05-15 19:16
wispyer
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2012-5-13
收藏
得分:0 
版主给改了什么地方呢??给说明一下吧!太感谢了!
2012-05-16 18:13
wispyer
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2012-5-13
收藏
得分:0 
回复 4楼 wangjy500
版主再给点文字说明吧,改了什么地方呢?
2012-05-16 18:14
wangjy500
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:13
帖 子:457
专家分:2569
注 册:2010-7-11
收藏
得分:0 
自已对照下吧。

QQ:63572063
2012-05-16 21:04
快速回复:关于网上找到的一段生日提醒源码怎么用
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.043051 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved