poche 发表于 2007-4-27 11:22:44

***链接特效***计算你的出生日在星期几。有时间有点意思

把下列代码加到网页的<body></body>标签之间 从google下载我的照片管理软件
<html>

<head><script language="javascript">

<!--
//author: michael gudaitis
//e-mail: jojoo@jojoo.net
//you may use this script free of charge so long as
//this copyright information stays intact.
//copyright 1998

function cala_day(form) {
      
      var nswitch = 0
      var nmonth = parseint(form.month.value)
      var nday =parseint(form.day.value)
      var nyear =parseint(form.year.value)
      
      if(!(nyear % 4) && (nmonth > 2)) {
                nswitch = 1
      }               

      var ndayofweek = cala_weekday(nmonth, nday, nyear)
      
      if(nswitch) {
                ndayofweek++
                nswitch = 0
      }
      
      day_display(form, ndayofweek)
}

function cala_weekday( x_nmonth, x_nday, x_nyear) {

      if(x_nmonth >= 3){      
                x_nmonth -= 2
      }
      else {
                x_nmonth += 10
      }

      if( (x_nmonth == 11) || (x_nmonth == 12) ){
                x_nyear--
      }

      var ncentnum = parseint(x_nyear / 100)
      var ndyearnum = x_nyear % 100
      
      var npart1 = parseint(2.6 * x_nmonth - .2)
      
      var nzeller = (parseint(npart1 + x_nday + ndyearnum + (ndyearnum / 4) + (ncentnum / 4) - 2 * ncentnum)) % 7
      
      if(nzeller < 0){
                nzeller += 7
      }
      
      return nzeller
}

function day_display(form, x_ndayofweek) {

      if(x_ndayofweek == 0) {
                form.birthday.value = "saturday"
                return
      }
      if(x_ndayofweek == 1) {
                form.birthday.value = "sunday"
                return
      }
      if(x_ndayofweek == 2) {
                form.birthday.value = "monday"
                return
      }
      if(x_ndayofweek == 3) {
                form.birthday.value = "tuesday"
                return
      }
      if(x_ndayofweek == 4) {
                form.birthday.value = "wednesday"
                return
      }
      if(x_ndayofweek == 5) {
                form.birthday.value = "thursday"
                return
      }
      if(x_ndayofweek == 6) {
                form.birthday.value = "friday"
                return
      }

      form.birthday.value = "not a valid date."
}
//-->

</script>

<title>javafile</title>
<base target="leftframe">
</head>

<body bgcolor="#ffffff" link="#cc0033" vlink="#333399" alink="#ff0000" <!--content start-->

<p align="center"><img src="http://www.javafile.com/images/banner.gif"
alt="banner.gif (2826 bytes)">http://www.javafile.com/images/banner.GIF</p>

<table width="96%" border="0" cellspacing="5" cellpadding="5">
<tr>
    <td width="100%">ever wonder what day you were born on? well, you can find out with this
    neat little script. simply type your bithdate in the algorithingie below, and it will tell
    ya'...honest!<font face="ariel,helvetica" size="-1"><p align="center"></font>author: <a
    href="mailto:sparrow@erols.com">michael gudaitis</a>   <a
    href="http://www.javafile.com/javascripts/clocks/calc3.zip">download the script</a><font
    face="ariel,helvetica" size="-1"></p>
    <p>to use this algorithm, input your date of birth (mm/dd/yyyy), press "ok" and
    then <i>boom</i> the day of the week in which you were born on appears. </p>
    <form>
      <div align="center"><center><table width="225" border="1" align="center">
      <tr>
          <td width="250" colspan="2" align="center" bgcolor="#0000ff"></font><font size="-1"
          color="#ffffff" face="ariel,helvetica"><b>zeller's algorithm</b></font><font
          face="ariel,helvetica" size="-1"></td>
      </tr>
      <tr>
          <td width="100" bgcolor="#ff0000"><font color="#ffff00"><font size="2"><b>month:</b><input
          type="text" name="month" size="4"><br>
          <br>
          <b>day:</b><input type="text" name="day" size="4"><br>
          <br>
          <b>year:</b><input type="text" name="year" size="4"></font> </font></td>
          <td width="125" align="center" bgcolor="#ff0000"><font color="#ffff00"><br>
          <font size="2"><b>example:</b></font> <br>
          <font size="2"><i><b>11-1-1970</b><br>
          <b>sunday</b></i><br>
          <br>
          <b>your were born on a</b></font> <br>
          <input type="text" name="birthday" size="10"> </font></td>
      </tr>
      <tr>
          <td colspan="2" align="center" bgcolor="#0000ff"><input type="button" value="ok"

          onclick="cala_day(this.form)"><input type="reset"></font></td>
      </tr>
      </table>
      </center></div>
    </form>
    </td>
</tr>
</table>
<!--content stop-->
</body>
</html>

      










--------------------------------------

http://www.huoyue.com.cn 活跃网,活跃人群的论坛,访问活跃网,将给您带来意想不到的收获,还可以免费为您开论坛,让您免费拥有与朋友、网友交流的论坛。你是年轻人吗?你活跃你就上!
页: [1]
查看完整版本: ***链接特效***计算你的出生日在星期几。有时间有点意思