Wed

18

Mar

2009

30、时间跳动 器简单代码

30、时间跳动 器简单代码

脚本说明:

第一步:把如下代码加入<head>区域中

<script language="JavaScript">

<!-- Hide this script from old browsers --

 

function modRange (value, min, max) {

 

    if (min == max) {

 

        return (min)

 

    }

 

    var low = Math.min (min, max)

 

    var high = Math.max (min, max)

 

    var range = high - low + 1

 

    var valOff = parseInt (value) - low

 

    var mod = range * Math.floor (valOff / range)

 

    result = low + valOff - mod

 

    if (result < low) {

 

        result += high

 

    }

 

    if (result > high) {

 

        result = low

 

    }

 

    return (result)

 

}

 

function array () {

 

    this[0] = null

 

}

 

function timerAppStart () {

 

    this.stop ()

 

    this.loop ()

 

}

 

function timerAppStop () {

 

    clearTimeout (this.timeout)

 

    this.timeout = null

 

}

 

function timerAppToggle () {

 

    if (this.timeout) {

 

        this.stop ()

 

    } else {

 

        this.start ()

 

    }

 

}

 

function timerAppLoop () {

 

    this.update ()

 

    command = this.name + '.loop()'

 

    for (var i = 0; i < this.syncCount; i++) {

 

        if (this.syncName[i] != '') {

 

            if (--this.syncCountdown[i] <= 0) {

 

                this.syncCountdown[i] = this.syncInterval[i]

 

                command += ';' + this.syncName[i] + '.update()'

 

            }

 

        }

 

    }

 

    this.timeout = setTimeout (command, this.interval)

 

}

 

function timerAppSetOutput (output) {

 

    if (! this.output) {

 

        this.output = output

 

    }

 

}

 

function timerAppSetInterval (interval) {

 

    if (interval) {

 

        var newInterval = parseInt (interval)

 

        if (newInterval > 0) {

 

            this.interval = newInterval

 

        } else {

 

            alert ('Interval value must be a positive number: ' + interval)

 

        }

 

    }

 

}

 

function timerAppSync (name, interval) {

 

    if (interval == null) {

 

        interval = 1

 

    }

 

    if (interval <= 0) {

 

        eval (this.name + '.unsync("' + name + '")')

 

        return

 

    }

 

    var newIndex = this.syncCount

 

    for (var i = 0; i < this.syncCount; i++) {

 

        if (this.syncName[i] == name) {

 

            newIndex = i

 

            break

 

        }

 

    }

 

    if (newIndex == this.syncCount) {

 

        this.syncCount++

 

    }

 

    this.syncInterval[newIndex] = interval

 

    this.syncCountdown[newIndex] = interval

 

    this.syncName[newIndex] = name

 

}

 

function timerAppUnsync (name) {

 

    for (var i = 0; i < this.syncCount; i++) {

 

        if (this.syncName[i] == name) {

 

            this.syncName[i] = ''

 

            if (i == (this.syncCount - 1)) {

 

                this.syncCount--

 

            }

 

        }

 

    }

 

}

 

function timerAppSetIncrement (increment) {

 

    if (increment) {

 

        var newIncrement = parseInt (increment)

 

//*Unix only*   if (! isNan (newIncrement)) {

 

        if (newIncrement != 0) {

 

            this.increment = newIncrement

 

        } else {

 

            alert ('Increment value must be a number: ' + increment)

 

        }

 

    }

 

}

 

function timerAppSetBounce (bounce) {

 

    if (bounce) {

 

        var newBounce = parseInt (bounce)

 

//*Unix only*   if (! isNan (newBounce)) {

 

        if (newBounce != 0) {

 

            this.bounce = newBounce

 

        } else {

 

            alert ('Bounce value must be a number: ' + bounce)

 

        }

 

    }

 

}

 

function timerAppSetOffset (offset) {

 

    if (offset) {

 

        var newOffset = parseInt (offset)

 

        if ((newOffset > 0)

 

            && (newOffset <= this.output.length)) {

 

            this.offset = newOffset

 

        } else {

 

            warnMessage = 'Value of offset must be a valid index (0 - '

 

                        + this.output.length + '): ' + offset

 

            alert (warnMessage)

 

        }

 

    }

 

}

 

function clock (name, output, interval) {

 

    // Initialize with default values

 

    this.name = name            // object name, needed for setTimeout

 

    this.output = null          // output area

 

    this.interval = 1000        // milliseconds

 

    this.timeout = null

 

    this.syncCount = 0

 

    this.syncName = new array ()

 

    this.syncInterval = new array ()

 

    this.syncCountdown = new array ()

 

    // Define object methods

 

    this.update = clockUpdate

 

    this.start = timerAppStart

 

    this.stop = timerAppStop

 

    this.toggle = timerAppToggle

 

    this.loop = timerAppLoop

 

    this.setOutput = timerAppSetOutput

 

    this.setInterval = timerAppSetInterval

 

    this.sync = timerAppSync

 

    this.unsync = timerAppUnsync

 

    // Initialize with specified values

 

    this.setOutput (output)

 

    this.setInterval (interval)

 

    this.start()

 

}

 

function clockUpdate () {

 

    var now = new Date()

 

    var timeHH = now.getHours();

 

    var timeMM = now.getMinutes()

 

    var timeSS = now.getSeconds()

 

    var msec = now.getTime ()

 

    var timeSSm = msec - 1000 * Math.floor (msec / 1000)

 

    timeSSm = '00' + timeSSm

 

    timeSSm = timeSSm.substring(timeSSm.length-3, timeSSm.length)

 

    var timeString = ((timeHH < 10) ? '0' : '') + timeHH

 

                 + ':' + ((timeMM < 10) ? '0' : '') + timeMM

 

                 + ':' + ((timeSS < 10) ? '0' : '') + timeSS

 

                 + '.' + timeSSm

 

    if (this.output) {

 

        this.output.value = timeString

 

    } else {

 

        self.status = timeString

 

    }

 

}

 

function buttons (name, output, interval, increment, bounce, offset) {

 

    // Initialize with default values

 

    this.name = name            

 

    this.output = null         

 

    this.interval = 1000       

 

    this.increment = 1         

 

    this.bounce = 1            

 

    this.offset = 0

 

    this.timeout = null

 

    this.syncCount = 0

 

    this.syncName = new array ()

 

    this.syncInterval = new array ()

 

    this.syncCountdown = new array ()

 

    // Define object methods

 

    this.update = buttonsUpdate

 

    this.start = timerAppStart

 

    this.stop = timerAppStop

 

    this.toggle = timerAppToggle

 

    this.loop = timerAppLoop

 

    this.setOutput = timerAppSetOutput

 

    this.setInterval = timerAppSetInterval

 

    this.sync = timerAppSync

 

    this.unsync = timerAppUnsync

 

    this.setIncrement = timerAppSetIncrement

 

    this.setBounce = timerAppSetBounce

 

    this.setOffset = timerAppSetOffset

 

    // Initialize with specified values

 

    this.setOutput (output)

 

    this.setInterval (interval)

 

    this.setIncrement (increment)

 

    this.setBounce (bounce)

 

    this.setOffset (offset)

 

    this.start()

 

}

 

function buttonsUpdate () {

 

    if (this.output) {

 

        var newOffset = this.offset + this.increment

 

        if ((newOffset < this.output.length)

 

            && (newOffset >= 0)) {

 

            this.offset = newOffset

 

        } else {

 

            this.increment *= this.bounce

 

            if (this.increment >= 0) {

 

                this.increment = modRange (this.increment, 0, this.output.length-1)

 

            } else {

 

                this.increment = 0 - modRange (Math.abs (this.increment),

 

                                0, this.output.length-1)

 

            }

 

            this.offset += this.increment

 

            this.offset = modRange (this.offset, 0, this.output.length-1)

 

        }

 

        this.output[this.offset].checked = true

 

    }

 

}

 

// -- End Hiding Here -->

</script>

 

 

 

第二步:把如下代码加入<body>区域中

<FORM NAME='clock' ACTION=''>

 

<TABLE BORDER=2><TR><TD>

 

<FONT SIZE=-2>

 

<INPUT TYPE='text' NAME='display' SIZE=8

 

 

 

 onFocus='wClock.toggle()'

 

 

 

 onMouseOver='self.status="Click here to turn on/off clock"; return true'>

 

</FONT>

 

</TD></TR></TABLE>

 

</FORM>

 

<FORM NAME='imastudios'>

 

<P>

 

<INPUT TYPE='radio' NAME='buttons'>

 

        Tick

 

<INPUT TYPE='radio' NAME='buttons'>

 

        Tock

 

<INPUT TYPE='radio' NAME='buttons'>

 

        Tick

 

<INPUT TYPE='radio' NAME='buttons'>

 

        Tock

 

<INPUT TYPE='radio' NAME='buttons'>

 

        Tick

 

</FORM>

 

 

 

第三步:<body>区中内容改为

<body bgcolor="#fef4d9" onLoad='wClock = new clock ("wClock", document.clock.display); wButtons = new buttons ("wButtons", document.imastudios.buttons, 500, 1,-1); wButtons.stop(); wClock.sync ("wButtons", 1)'onUnload='wClock.stop(); wButtons.stop()' bgcolor="#FFFFFF">

 

0 Comments

Wed

18

Mar

2009

29、可爱钟表特效代码

29、可爱钟表特效代码

<iframe scrolling="no" frameborder="0" width="180" height="200" src="http://www.7stk.com/shijian/t4601.htm" allowtransparency="true"></iframe>

 

1 Comments

Wed

18

Mar

2009

28、可爱钟表特效代码

28、可爱钟表特效代码

<iframe scrolling="no" frameborder="0" width="180" height="198" src="http://www.7stk.com/shijian/t4501.htm" allowtransparency="true"></iframe>

 

0 Comments

Wed

18

Mar

2009

27、超强超靓网页日历

27、超强超靓网页日历

<html>

 

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>网页特效---超强超靓网页日历代码</title>

</head>

 

<body>

 

 

<SCRIPT language=JavaScript>

<!--

/*****************************************************************************

                                   日期资料

*****************************************************************************/

 

var lunarInfo=new Array(

0x04bd8,0x04ae0,0x0a570,0x054d5,0x0d260,0x0d950,0x16554,0x056a0,0x09ad0,0x055d2,

0x04ae0,0x0a5b6,0x0a4d0,0x0d250,0x1d255,0x0b540,0x0d6a0,0x0ada2,0x095b0,0x14977,

0x04970,0x0a4b0,0x0b4b5,0x06a50,0x06d40,0x1ab54,0x02b60,0x09570,0x052f2,0x04970,

0x06566,0x0d4a0,0x0ea50,0x06e95,0x05ad0,0x02b60,0x186e3,0x092e0,0x1c8d7,0x0c950,

0x0d4a0,0x1d8a6,0x0b550,0x056a0,0x1a5b4,0x025d0,0x092d0,0x0d2b2,0x0a950,0x0b557,

0x06ca0,0x0b550,0x15355,0x04da0,0x0a5d0,0x14573,0x052d0,0x0a9a8,0x0e950,0x06aa0,

0x0aea6,0x0ab50,0x04b60,0x0aae4,0x0a570,0x05260,0x0f263,0x0d950,0x05b57,0x056a0,

0x096d0,0x04dd5,0x04ad0,0x0a4d0,0x0d4d4,0x0d250,0x0d558,0x0b540,0x0b5a0,0x195a6,

0x095b0,0x049b0,0x0a974,0x0a4b0,0x0b27a,0x06a50,0x06d40,0x0af46,0x0ab60,0x09570,

0x04af5,0x04970,0x064b0,0x074a3,0x0ea50,0x06b58,0x055c0,0x0ab60,0x096d5,0x092e0,

0x0c960,0x0d954,0x0d4a0,0x0da50,0x07552,0x056a0,0x0abb7,0x025d0,0x092d0,0x0cab5,

0x0a950,0x0b4a0,0x0baa4,0x0ad50,0x055d9,0x04ba0,0x0a5b0,0x15176,0x052b0,0x0a930,

0x07954,0x06aa0,0x0ad50,0x05b52,0x04b60,0x0a6e6,0x0a4e0,0x0d260,0x0ea65,0x0d530,

0x05aa0,0x076a3,0x096d0,0x04bd7,0x04ad0,0x0a4d0,0x1d0b6,0x0d250,0x0d520,0x0dd45,

0x0b5a0,0x056d0,0x055b2,0x049b0,0x0a577,0x0a4b0,0x0aa50,0x1b255,0x06d20,0x0ada0)

 

var solarMonth=new Array(31,28,31,30,31,30,31,31,30,31,30,31);

var Gan=new Array("","","","","","","","","","");

var Zhi=new Array("","","","","","","","","","","","");

var Animals=new Array("","","","","","","","","","","","");

var solarTerm = new Array("小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至")

var sTermInfo = new Array(0,21208,42467,63836,85337,107014,128867,150921,173149,195551,218072,240693,263343,285989,308563,331033,353350,375494,397447,419210,440795,462224,483532,504758)

var nStr1 = new Array('','','','','','','','','','','')

var nStr2 = new Array('','','廿','',' ')

var monthName = new Array("JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC");

 

//国历节日 *表示放假日

var sFtv = new Array(

"0101*元旦",

"0214 情人节",

"0303 我生日",

"0308 妇女节",

"0312 植树节",

"0315 消费者权益日",

"0317 St. Patrick's",

"0401 愚人节",

"0501 劳动节",

"0504 青年节",

"0512 护士节",

"0512 茵生日",

"0601 儿童节",

"0614 Flag Day",

"0701 建党节 香港回归纪念",

"0703 炎黄在线诞辰",

"0718 托普诞辰",

"0801 建军节",

"0808 父亲节",

"0909 毛泽东逝世纪念",

"0910 教师节",

"0928 孔子诞辰",

"1001*国庆节",

"1006 老人节",

"1024 联合国日",

"1111 Veteran's / Remembrance Day",

"1112 孙中山诞辰纪念",

"1220 澳门回归纪念",

"1225 Christmas Day",

"1226 毛泽东诞辰纪念")

 

//农历节日 *表示放假日

var lFtv = new Array(

"0101*春节",

"0115 元宵节",

"0505 端午节",

"0707 七夕情人节",

"0715 中元节",

"0815 中秋节",

"0909 重阳节",

"1208 腊八节",

"1224 小年",

"0100*除夕")

 

//某月的第几个星期几

var wFtv = new Array(

"0131 Martin Luther King Day",

"0231 President's Day",

"0520 母亲节",

"0530 Armed Forces Day",

"0531 Victoria Day",

"0716 合作节",

"0730 被奴役国家周",

"0811 Civic Holiday",

"0911 Labor Holiday",

"1021 Columbus Day",

"1144 Thanksgiving")

 

 

/*****************************************************************************

                                      日期计算

*****************************************************************************/

 

//====================================== 传回农历 y年的总天数

function lYearDays(y) {

   var i, sum = 348

   for(i=0x8000; i>0x8; i>>=1) sum += (lunarInfo[y-1900] & i)? 1: 0

   return(sum+leapDays(y))

}

 

//====================================== 传回农历 y年闰月的天数

function leapDays(y) {

   if(leapMonth(y))  return((lunarInfo[y-1900] & 0x10000)? 30: 29)

   else return(0)

}

 

//====================================== 传回农历 y年闰哪个月 1-12 , 没闰传回 0

function leapMonth(y) {

   return(lunarInfo[y-1900] & 0xf)

}

 

//====================================== 传回农历 ym月的总天数

function monthDays(y,m) {

   return( (lunarInfo[y-1900] & (0x10000>>m))? 30: 29 )

}

 

//====================================== 算出农历, 传入日期物件, 传回农历日期物件

//                                       该物件属性有 .year .month .day .isLeap .yearCyl .dayCyl .monCyl

function Lunar(objDate) {

 

   var i, leap=0, temp=0

   var baseDate = new Date(1900,0,31)

   var offset   = (objDate - baseDate)/86400000

 

   this.dayCyl = offset + 40

   this.monCyl = 14

 

   for(i=1900; i<2050 && offset>0; i++) {

      temp = lYearDays(i)

      offset -= temp

      this.monCyl += 12

   }

 

   if(offset<0) {

      offset += temp;

      i--;

      this.monCyl -= 12

   }

 

   this.year = i

   this.yearCyl = i-1864

 

   leap = leapMonth(i) //闰哪个月

   this.isLeap = false

 

   for(i=1; i<13 && offset>0; i++) {

      //闰月

      if(leap>0 && i==(leap+1) && this.isLeap==false)

         { --i; this.isLeap = true; temp = leapDays(this.year); }

      else

         { temp = monthDays(this.year, i); }

 

      //解除闰月

      if(this.isLeap==true && i==(leap+1)) this.isLeap = false

 

      offset -= temp

      if(this.isLeap == false) this.monCyl ++

   }

 

   if(offset==0 && leap>0 && i==leap+1)

      if(this.isLeap)

         { this.isLeap = false; }

      else

         { this.isLeap = true; --i; --this.monCyl;}

 

   if(offset<0){ offset += temp; --i; --this.monCyl; }

 

   this.month = i

   this.day = offset + 1

}

 

//==============================传回国历 y年某m+1月的天数

function solarDays(y,m) {

   if(m==1)

      return(((y%4 == 0) && (y%100 != 0) || (y%400 == 0))? 29: 28)

   else

      return(solarMonth[m])

}

//============================== 传入 offset 传回干支, 0=甲子

function cyclical(num) {

   return(Gan[num%10]+Zhi[num%12])

}

 

//============================== 月历属性

function calElement(sYear,sMonth,sDay,week,lYear,lMonth,lDay,isLeap,cYear,cMonth,cDay) {

 

      this.isToday    = false;

      //国历

      this.sYear      = sYear;

      this.sMonth     = sMonth;

      this.sDay       = sDay;

      this.week       = week;

      //农历

      this.lYear      = lYear;

      this.lMonth     = lMonth;

      this.lDay       = lDay;

      this.isLeap     = isLeap;

      //干支

      this.cYear      = cYear;

      this.cMonth     = cMonth;

      this.cDay       = cDay;

 

      this.color      = '';

 

      this.lunarFestival = ''; //农历节日

      this.solarFestival = ''; //国历节日

      this.solarTerms    = ''; //节气

 

}

 

//===== 某年的第n个节气为几日(0小寒起算)

function sTerm(y,n) {

   var offDate = new Date( ( 31556925974.7*(y-1900) + sTermInfo[n]*60000  ) + Date.UTC(1900,0,6,2,5) )

   return(offDate.getUTCDate())

}

 

//============================== 传回月历物件 (y,m+1)

function calendar(y,m) {

 

   var sDObj, lDObj, lY, lM, lD=1, lL, lX=0, tmp1, tmp2

   var lDPOS = new Array(3)

   var n = 0

   var firstLM = 0

 

   sDObj = new Date(y,m,1)            //当月一日日期

 

   this.length    = solarDays(y,m)    //国历当月天数

   this.firstWeek = sDObj.getDay()    //国历当月1日星期几

 

 

   for(var i=0;i<this.length;i++) {

 

      if(lD>lX) {

         sDObj = new Date(y,m,i+1)    //当月一日日期

         lDObj = new Lunar(sDObj)     //农历

         lY    = lDObj.year           //农历年

         lM    = lDObj.month          //农历月

         lD    = lDObj.day            //农历日

         lL    = lDObj.isLeap         //农历是否闰月

         lX    = lL? leapDays(lY): monthDays(lY,lM) //农历当月最後一天

 

         if(n==0) firstLM = lM

         lDPOS[n++] = i-lD+1

      }

 

      //sYear,sMonth,sDay,week,

      //lYear,lMonth,lDay,isLeap,

      //cYear,cMonth,cDay

      this[i] = new calElement(y, m+1, i+1, nStr1[(i+this.firstWeek)%7],

                               lY, lM, lD++, lL,

                               cyclical(lDObj.yearCyl) ,cyclical(lDObj.monCyl), cyclical(lDObj.dayCyl++) )

 

 

      if((i+this.firstWeek)%7==0)   this[i].color = 'red'  //周日颜色

      if((i+this.firstWeek)%14==13) this[i].color = 'red'  //周休二日颜色

   }

 

   //节气

   tmp1=sTerm(y,m*2  )-1

   tmp2=sTerm(y,m*2+1)-1

   this[tmp1].solarTerms = solarTerm[m*2]

   this[tmp2].solarTerms = solarTerm[m*2+1]

   if(m==3) this[tmp1].color = 'red' //清明颜色

 

   //国历节日

   for(i in sFtv)

      if(sFtv[i].match(/^(\d{2})(\d{2})([\s\*])(.+)$/))

         if(Number(RegExp.$1)==(m+1)) {

            this[Number(RegExp.$2)-1].solarFestival += RegExp.$4 + ' '

            if(RegExp.$3=='*') this[Number(RegExp.$2)-1].color = 'red'

         }

 

   //月周节日

   for(i in wFtv)

      if(wFtv[i].match(/^(\d{2})(\d)(\d)([\s\*])(.+)$/))

         if(Number(RegExp.$1)==(m+1)) {

            tmp1=Number(RegExp.$2)

            tmp2=Number(RegExp.$3)

            this[((this.firstWeek>tmp2)?7:0) + 7*(tmp1-1) + tmp2 - this.firstWeek].solarFestival += RegExp.$5 + ' '

         }

 

   //农历节日

   for(i in lFtv)

      if(lFtv[i].match(/^(\d{2})(.{2})([\s\*])(.+)$/)) {

         tmp1=Number(RegExp.$1)-firstLM

         if(tmp1==-11) tmp1=1

         if(tmp1 >=0 && tmp1<n) {

            tmp2 = lDPOS[tmp1] + Number(RegExp.$2) -1

            if( tmp2 >= 0 && tmp2<this.length) {

               this[tmp2].lunarFestival += RegExp.$4 + ' '

               if(RegExp.$3=='*') this[tmp2].color = 'red'

            }

         }

      }

 

   //黑色星期五

   if((this.firstWeek+12)%7==5)

      this[12].solarFestival += '黑色星期五 '

 

   //今日

   if(y==tY && m==tM) this[tD-1].isToday = true;

 

}

 

//====================== 中文日期

function cDay(d){

   var s;

 

   switch (d) {

      case 10:

         s = '初十'; break;

      case 20:

         s = '二十'; break;

         break;

      case 30:

         s = '三十'; break;

         break;

      default :

         s = nStr2[Math.floor(d/10)];

         s += nStr1[d%10];

   }

   return(s);

}

 

///////////////////////////////////////////////////////////////////////////////

 

var cld;

 

function drawCld(SY,SM) {

   var i,sD,s,size;

   cld = new calendar(SY,SM);

 

   if(SY>1874 && SY<1909) yDisplay = '光绪' + (((SY-1874)==1)?'':SY-1874)

   if(SY>1908 && SY<1912) yDisplay = '宣统' + (((SY-1908)==1)?'':SY-1908)

   if(SY>1911 && SY<1950) yDisplay = '民国' + (((SY-1911)==1)?'':SY-1911)

//   if(SY>1949) yDisplay = '共和国' + (((SY-1949)==1)?'':SY-1949)

 

  // GZ.innerHTML = yDisplay +' 农历' + cyclical(SY-1900+36) + '   '+Animals[(SY-4)%12]+'';

 

   if(SY>1949) yDisplay = ''

 

   GZ.innerHTML = yDisplay +' 农历' + cyclical(SY-1900+36) + '   '+Animals[(SY-4)%12]+'';

 

   YMBG.innerHTML = " " + SY + "<BR> " + monthName[SM];

 

 

   for(i=0;i<42;i++) {

 

      sObj=eval('SD'+ i);

      lObj=eval('LD'+ i);

 

      sObj.className = '';

 

      sD = i - cld.firstWeek;

 

      if(sD>-1 && sD<cld.length) { //日期内

         sObj.innerHTML = sD+1;

 

         if(cld[sD].isToday) sObj.className = 'todyaColor'; //今日颜色

 

         sObj.style.color = cld[sD].color; //国定假日颜色

 

         if(cld[sD].lDay==1) //显示农历月

            lObj.innerHTML = '<b>'+(cld[sD].isLeap?'':'') + cld[sD].lMonth + '' + (monthDays(cld[sD].lYear,cld[sD].lMonth)==29?'':'')+'</b>';

         else //显示农历日

            lObj.innerHTML = cDay(cld[sD].lDay);

 

         s=cld[sD].lunarFestival;

         if(s.length>0) { //农历节日

            if(s.length>6) s = s.substr(0, 4)+'…';

            s = s.fontcolor('red');

         }

         else { //国历节日

            s=cld[sD].solarFestival;

            if(s.length>0) {

               size = (s.charCodeAt(0)>0 && s.charCodeAt(0)<128)?8:4;

               if(s.length>size+2) s = s.substr(0, size)+'…';

               s = s.fontcolor('blue');

            }

            else { //廿四节气

               s=cld[sD].solarTerms;

               if(s.length>0) s = s.fontcolor('limegreen');

            }

         }

         if(s.length>0) lObj.innerHTML = s;

 

      }

      else { //非日期

         sObj.innerHTML = '';

         lObj.innerHTML = '';

      }

   }

}

 

function changeLong()

{

var y,m,ly,lm,id,im,iy,yangy,yangm,deltm,miny,tt;

CLD.SY.selectedIndex=CLD.D1.selectedIndex;

CLD.SM.selectedIndex=CLD.D2.selectedIndex;

yangm=0;yangy=0;

tt=true;

while (tt)

       {

       yangm=0;yangy=0;

                     changeCld();

                 for(i=0;i<42;i++)

                 {

                    sD = i - cld.firstWeek;

                    if(sD>-1 && sD<cld.length)

                    { //日期内

                           if ((cld[sD].lMonth==CLD.D2.selectedIndex+1)&&(cld[sD].lYear==CLD.D1.selectedIndex+1900))

                           {

                                   yangy=CLD.SY.selectedIndex+1900;   yangm=CLD.SM.selectedIndex ;

                                   tt=false;

                                   break;

                                   }

                        }

                 }

                 if (!tt) break;

             

                     pushBtm('MD');

                     changeCld();

 

//                   alert(CLD.SY.selectedIndex+" "+CLD.SM.selectedIndex);

 

                 for(i=0;i<42;i++)

                 {

                    sD = i - cld.firstWeek;

                    if(sD>-1 && sD<cld.length)

                    { //日期内

                           if ((cld[sD].lMonth==CLD.D2.selectedIndex+1)&&(cld[sD].lYear==CLD.D1.selectedIndex+1900))

                           {

                                   yangy=CLD.SY.selectedIndex+1900;   yangm=CLD.SM.selectedIndex ;

                                   tt=false;

                                   break;

                                   }

                        }

                 }

                     break;           

       }

//            alert(yangy+" "+yangm);

      

 

//CLD.SY.selectedIndex=yangy;//-1900;

//pushBtm('YU');

//pushBtm('YD');

CLD.SM.selectedIndex=yangm;

pushBtm('MD');

pushBtm('MU');

     

            

     

}

//changeLong end

 

function changeCld() {

   var y,m;

   y=CLD.SY.selectedIndex+1900;

   m=CLD.SM.selectedIndex;

   drawCld(y,m);

}

 

function pushBtm(K) {

   switch (K){

      case 'YU' :

         if(CLD.SY.selectedIndex>0) CLD.SY.selectedIndex--;

         break;

      case 'YD' :

         if(CLD.SY.selectedIndex<149) CLD.SY.selectedIndex++;

         break;

      case 'MU' :

         if(CLD.SM.selectedIndex>0) {

            CLD.SM.selectedIndex--;

         }

         else {

            CLD.SM.selectedIndex=11;

            if(CLD.SY.selectedIndex>0) CLD.SY.selectedIndex--;

         }

         break;

      case 'MD' :

         if(CLD.SM.selectedIndex<11) {

            CLD.SM.selectedIndex++;

         }

         else {

            CLD.SM.selectedIndex=0;

            if(CLD.SY.selectedIndex<149) CLD.SY.selectedIndex++;

         }

         break;

      default :

         CLD.SY.selectedIndex=tY-1900;

         CLD.SM.selectedIndex=tM;

   }

   changeCld();

}

 

 

 

var Today = new Date();

var tY = Today.getFullYear();

var tM = Today.getMonth();

var tD = Today.getDate();

//////////////////////////////////////////////////////////////////////////////

 

var width = "130";

var offsetx = 2;

var offsety = 16;

 

var x = 0;

var y = 0;

var snow = 0;

var sw = 0;

var cnt = 0;

 

var dStyle;

document.onmousemove = mEvn;

 

//显示详细日期资料

function mOvr(v) {

   var s,festival;

   var sObj=eval('SD'+ v);

   var d=sObj.innerHTML-1;

 

      //sYear,sMonth,sDay,week,

      //lYear,lMonth,lDay,isLeap,

      //cYear,cMonth,cDay

 

   if(sObj.innerHTML!='') {

 

      sObj.style.cursor = 's-resize';

 

      if(cld[d].solarTerms == '' && cld[d].solarFestival == '' && cld[d].lunarFestival == '')

         festival = '';

      else

         festival = '<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR="#CCFFCC"><TR><TD>'+

         '<FONT COLOR="#000000" STYLE="font-size:9pt;">'+cld[d].solarTerms + ' ' + cld[d].solarFestival + ' ' + cld[d].lunarFestival+'</FONT></TD>'+

         '</TR></TABLE>';

 

      s= '<TABLE WIDTH="130" BORDER=0 CELLPADDING="2" CELLSPACING=0 BGCOLOR="#000066"><TR><TD>' +

         '<TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD ALIGN="right"><FONT COLOR="#ffffff" STYLE="font-size:9pt;">'+

         cld[d].sYear+' '+cld[d].sMonth+' '+cld[d].sDay+' <br>星期'+cld[d].week+'<br>'+

         '<font color="violet">农历'+(cld[d].isLeap?' ':' ')+cld[d].lMonth+' '+cld[d].lDay+' </font><br>'+

         '<font color="yellow">'+cld[d].cYear+' '+cld[d].cMonth+' '+cld[d].cDay + '</font>'+

         '</FONT></TD></TR></TABLE>'+ festival +'</TD></TR></TABLE>';

 

 

      document.all["detail"].innerHTML = s;

 

     if (snow == 0) {

         dStyle.left = x+offsetx-(width/2);

         dStyle.top = y+offsety;

            dStyle.visibility = "visible";

            snow = 1;

     }

       }

}

 

//清除详细日期资料

function mOut() {

       if ( cnt >= 1 ) { sw = 0 }

       if ( sw == 0 ) { snow = 0;     dStyle.visibility = "hidden";}

       else cnt++;

}

 

//取得位置

function mEvn() {

   x=event.x;

   y=event.y;

       if (document.body.scrollLeft)

          {x=event.x+document.body.scrollLeft; y=event.y+document.body.scrollTop;}

       if (snow){

      dStyle.left = x+offsetx-(width/2)

      dStyle.top = y+offsety

       }

}

 

///////////////////////////////////////////////////////////////////////////

 

 

function tick() {

   var today

   today = new Date()

   Clock.innerHTML = today.toLocaleString().replace(/(|)/g, "/").replace(//, "");

//   Clock.innerHTML = TimeAdd(today.toGMTString(), CLD.TZ.value)

   window.setTimeout("tick()", 1000);

}

 

function setCookie(name, value) {

       var today = new Date()

       var expires = new Date()

       expires.setTime(today.getTime() + 1000*60*60*24*365)

       document.cookie = name + "=" + escape(value)   + "; expires=" + expires.toGMTString()

}

 

function getCookie(Name) {

   var search = Name + "="

   if(document.cookie.length > 0) {

      offset = document.cookie.indexOf(search)

      if(offset != -1) {

         offset += search.length

         end = document.cookie.indexOf(";", offset)

         if(end == -1) end = document.cookie.length

         return unescape(document.cookie.substring(offset, end))

      }

      else return ""

   }

}

 

/////////////////////////////////////////////////////////

 

function initial() {

   dStyle = detail.style;

   CLD.SY.selectedIndex=tY-1900;

   CLD.SM.selectedIndex=tM;

   drawCld(tY,tM);

 

//   CLD.TZ.selectedIndex=getCookie("TZ");

//   changeTZ();

   tick();

}

 

 

 

//-->

</SCRIPT>

 

<STYLE>.todyaColor {

       BACKGROUND-COLOR: aqua

}

</STYLE>

 

<META content="Microsoft FrontPage 6.0" name=GENERATOR></HEAD>

<BODY onload=initial()>

<SCRIPT language=JavaScript><!--

   if(navigator.appName == "Netscape" || parseInt(navigator.appVersion) < 4)

   document.write("<h1>你的浏览器无法执行此程序。</h1>此程序在 IE4 以后的版本才能执行!!")

//--></SCRIPT>

 

<DIV id=detail style="POSITION: absolute"></DIV>

<FORM name=CLD>

<div align="center">

<TABLE width="672" align="right" height="259" bordercolordark="#CC9900" border="4" background="l11.gif">

  <CENTER>

<center>

  <TBODY>

  </center></center>

  <TR>

  <TD align=middle vAlign=top width="170" height="255">

  <div align="center">

    <center>

  <TABLE BORDER=1 COLSPAN=2 width="221">

  <CENTER>

    <center><FONT size=2

      style="FONT-SIZE: 9pt">

    <td width="209">

      <p align="center"><font style="font-size:10.8pt" color=RED>本地计算机时间:</FONT></FONT><BR><FONT color=#000080 face=ARIAL

      id=Clock size=3 align="center"></FONT>

      <P><!--时区 *表示自动调整为日光节约时间-->

      </center>

   </CENTER>

   </TABLE>

  </center>

    </div>

    <div align="center">

      <center>

      <table border=1 height="1" width="16">

      <td height="1" width="255">

            <table width="212" height="1"><CENTER>

            <center>

      <FONT id=tSave

      style="COLOR: red; FONT-FAMILY: Wingdings; FONT-SIZE: 18pt"></FONT>

      <td height="1" width="152"><font size="2"><FONT style="FONT-SIZE: 9pt">

      <font color="#0000FF">公历</font></font><FONT color=#ffffff

            style="FONT-SIZE: 9pt"><SELECT name=SY onchange=changeCld()

            style="FONT-SIZE: 9pt">

              <SCRIPT language=JavaScript><!--

            for(i=1900;i<2050;i++) document.write('<option>'+i)

            //--></SCRIPT>

            </SELECT> </FONT><FONT color=#ffffff

            style="FONT-SIZE: 9pt"><SELECT name=SM onchange=changeCld()

            style="FONT-SIZE: 9pt">

              <SCRIPT language=JavaScript><!--

            for(i=1;i<13;i++) document.write('<option>'+i)

            //--></SCRIPT>

            </SELECT></FONT></font>

      <P><font size="2"><FONT style="FONT-SIZE: 9pt"><font color="#0000FF">阴历</font></font><FONT color=#ffffff

            style="FONT-SIZE: 9pt"><SELECT name=D1 onchange=changeLong()

            style="FONT-SIZE: 9pt">

              <SCRIPT language=JavaScript><!--

            for(i=1900;i<2050;i++) document.write('<option>'+i)

            //--></SCRIPT>

            </SELECT> </FONT><FONT color=#ffffff

            style="FONT-SIZE: 9pt"><SELECT name=D2 onchange=changeLong()

            style="FONT-SIZE: 9pt">

              <SCRIPT language=JavaScript><!--

            for(i=1;i<13;i++) document.write('<option>'+i)

            //--></SCRIPT>

            </SELECT></FONT></font></P>

      <div align="center" style="width: 4; height: 1">

      </div>

      <td width="1" align="center" height="1">

      <BUTTON onclick="pushBtm('MU')"  style="FONT-SIZE: 9pt">月↑</BUTTON>

      <BUTTON onclick="pushBtm('')" style="FONT-SIZE: 9pt">当月</BUTTON>

      <BUTTON onclick="pushBtm('MD')"  style="FONT-SIZE: 9pt">月↓</BUTTON>

      </td>

        </center></center>

       <tr>

              <CENTER>

      <TD align=center vAlign=top width=152 height="1">

      <BUTTON onclick="pushBtm('YU')" style="FONT-SIZE: 9pt">年↑</BUTTON>

      <BUTTON onclick="pushBtm('YD')" style="FONT-SIZE: 9pt">年↓</BUTTON>

      </TD>

        </center>

      <td colspan=2 width="46" height="1">

          <p align="left"><INPUT onclick="javascript:window.close();" style="FONT-SIZE: 9pt" type=button value=关闭></p>

      </td>

 

       </table>

              <CENTER>

        <table border="1" width="100%" height="1" bordercolordark="#FFFFCC">

        <tr>

          <td width="100%" height="1"><font style="font-size:10.8pt" color=#0>  

            阴历存在跨月情况,如果查找到的阴历月跨两个公历月,用<font color=blue>[月↑][月↓]</font>翻动可以找到你想要的确切日期。</font></td>

        </tr>

      </table>

      </CENTER>

      </table>

      </center>

    </div>

    <TD align=middle width="423" height="255">

      <DIV style="position: absolute; top: 31; z-index: -1; left: 270; width: 347; height: 108">

        <p>

        <p>

        <p><FONT id=YMBG

      style="COLOR: #f0f0f0; FONT-FAMILY: 'Arial Black'; FONT-SIZE: 20pt"> </FONT>

      </DIV>

      <div align="center">

      <center>

      <TABLE border=0 height="27" cellspacing="1">

        <TBODY>

        <TR>

          <TD bgColor=#000080 colSpan=7 align="center" height="24"><FONT color=#000080 size=2

            style="FONT-SIZE: 9pt"></FONT> <FONT color=#ffffff face=宋体 id=GZ

            size=4></FONT><BR></TD></TR>

        <TR align=middle bgColor=#e0e0e0>

          <TD width=54 height="1" align="center" bgcolor="#99CCFF"><font size="2"></font></TD>

          <TD width=54 height="1" align="center" bgcolor="#99CCFF"><font size="2"></font></TD>

          <TD width=54 height="1" align="center" bgcolor="#99CCFF"><font size="2"></font></TD>

          <TD width=50 height="1" align="center" bgcolor="#99CCFF"><font size="2"></font></TD>

          <TD width=54 height="1" align="center" bgcolor="#99CCFF"><font size="2"></font></TD>

          <TD width=54 height="1" align="center" bgcolor="#99CCFF"><font size="2"></font></TD>

          <TD width=54 height="1" align="center" bgcolor="#99CCFF"><font size="2"></font></TD></TR>

        <SCRIPT language=JavaScript><!--

            var gNum

            for(i=0;i<6;i++) {

               document.write('<tr align=center>')

               for(j=0;j<7;j++) {

                  gNum = i*7+j

                  document.write('<td id="GD' + gNum +'" onMouseOver="mOvr(' + gNum +')" onMouseOut="mOut()"><font id="SD' + gNum +'" size=2 face="Arial Black"')

                  if(j == 0) document.write(' color=red')

                  if(j == 6)

                     if(i%2==1) document.write(' color=red')

                        else document.write(' color=green')

                  document.write(' TITLE=""> </font><br><font id="LD' + gNum + '" size=2 style="font-size:9pt"> </font></td>')

               }

               document.write('</tr>')

            }

            //--></SCRIPT>

        </TBODY></TABLE>

      </center>

      </div>

  </TD>

</TR></TBODY></TABLE>

</div>

</FORM> 

 

</body>

 

</html>

 

 

0 Comments

Wed

18

Mar

2009

26、时钟加在背景上

26、时钟加在背景上

脚本说明:

第一步:把如下代码加入<head>区域中:

<script language=javaScript>

<!--//

 

function clockon() {

thistime= new Date()

var hours=thistime.getHours()

var minutes=thistime.getMinutes()

var seconds=thistime.getSeconds()

if (eval(hours) <10) {hours="0"+hours}

if (eval(minutes) < 10) {minutes="0"+minutes}

if (seconds < 10) {seconds="0"+seconds}

thistime = hours+":"+minutes+":"+seconds

 

if(document.all) {

bgclocknoshade.innerHTML=thistime

bgclockshade.innerHTML=thistime

}

 

if(document.layers) {

document.bgclockshade.document.write('<div id="bgclockshade" style="position:absolute;visibility:visible;font-family:Verdana;color:FFAAAAA;font-size:120px;top:10px;left:152px">'+thistime+'</div>')

document.bgclocknoshade.document.write('<div id="bgclocknoshade" style="position:absolute;visibility:visible;font-family:Verdana;color:DDDDDD;font-size:120px;top:10px;left:150px">'+thistime+'</div>')

document.close()

}

var timer=setTimeout("clockon()",200)

}

 

//-->

</script>

 

 

 

第二步:<body>中加入如下代码:

<div id="bgclockshade" style="position:absolute;visibility:visible;font-family:Arial;color:FF8888;font-size:120px;top:102px;left:152px"></div>

 

<div id="bgclocknoshade" style="position:absolute;visibility:visible;font-family:Arial;color:DDDDDD;font-size:120px;top:100px;left:150px"></div>

 

<div id="mainbody" style="position:absolute; visibility:visible">

</div>

 

第三步:把<body>中内容改为:

<body bgcolor="#fef4d9" onLoad="clockon()">

 

0 Comments

Wed

18

Mar

2009

25、随时间变化提示 代码

25、随时间变化提示 代码

脚本说明:

把如下代码加入<body>区域中

<SCRIPT language="JavaScript">

<!-----------

   var enabled = 0;   today = new Date();

   var day;   var date;

   if(today.getDay()==0)     day = "星期日"

   if(today.getDay()==1)     day = "星期一"

   if(today.getDay()==2)     day = "星期二"

   if(today.getDay()==3)     day = "星期三"

   if(today.getDay()==4)     day = "星期四"

   if(today.getDay()==5)     day = "星期五"

   if(today.getDay()==6)     day = "星期六"

   document.fgColor = " FF0072";

   date1 = "<font size=2 color=red>" + (today.getYear())  + "" + (today.getMonth() + 1 ) + "" + today.getDate() + "  " + "</font>";

   date2 = "<font size=1 color=red>" +  day + "</font>";

   document.write("<center>" + date1.fontsize(3) + date2.fontsize(3) + "</center>");

  

//----->

</SCRIPT>

<SCRIPT language="JavaScript">

 

<!--

document.write("<center><font color=#0066ff size=+1> ")

day = new Date()

hr = day.getHours()

if (hr ==1)

document.write("凌晨一点已过,别忘了休息喔!")

if (hr ==2)

document.write("该休息了,身体可是革命的本钱啊!")

if (hr ==3)

document.write("夜深人静,只有你敲击鼠标的声音...")

if (hr ==4)

document.write("四点过了,你明天不上班???")

if (hr ==5)

document.write("该去晨运了!!!")

if (hr ==6)

document.write("你知道吗,此时是国内网络速度最快的时候!")

if (hr ==7)

document.write("新的一天又开始了,祝你过得快乐!")

if ((hr ==8) || (hr == 9) || (hr ==10))

document.write("上午好!今天你看上去好精神哦!")

if (hr ==11)

document.write("十一点过了,快下班了吧?")

if (hr ==12)

document.write("十二点过了,还不下班?")

if ((hr==13) || (hr==14))

document.write("你不睡午觉?")

if ((hr==15) || (hr==16) || (hr==17))

document.write("下午好!")

if ((hr==18) || (hr==19))

document.write("吃晚饭了吧?")

if ((hr==20) || (hr==21) || (hr==22))

document.write("今晚又在这玩电脑了,没节目?")

if (hr==23)

document.write("真是越玩越精神,不打算睡了?")

if (hr==0)

document.write("凌晨了,还不睡?")

document.write("</font></center>")

//--->

 

</SCRIPT>

 

0 Comments

Wed

18

Mar

2009

24、计算出生日期 代码

24、计算出生日期 代码

脚本说明:

第一步:把如下代码加入<body>区域中:

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

var mm = prompt('What month were you born in?','1-12');

var bday = prompt('What day were you born on?','1-31');

var byear = prompt('What year were you born in?','1975');

var year = new Date();

var year2 = year.getYear();

var year3 = (year < 2000) ? year2 + 1900 : year2;

thedate = new Date();

mm2 = thedate.getMonth() + 1;

dd2 = thedate.getDate();

yy2 = thedate.getYear();

if (yy2 < 100) yy2 += 1900

yourage = yy2 - byear;

if (mm2 < mm) yourage--;

if ((mm2 == mm) && (dd2 < bday)) yourage--;

TMonth = new Array(

'January','February','March',

'April','May','June','July',

'August','September','October',

'November','December'

);

CurMonth = mm - 1;

bmonth = TMonth[CurMonth];

var age2 = yourage + 1;

var timerID;

var timerRunning = false;

var today = new Date();

var startday = new Date();

var enday = new Date();

var secPerDay = 0;

var minPerDay = 0;

var hourPerDay = 0;

var secsLeft = 0;

var secsRound = 0;

var secsRemain = 0;

var minLeft = 0;

var minRound = 0;

var minRemain = 0;

var timeRemain = 0;

function stopclock() {

if(timerRunning)

clearTimeout(timerID);

timerRunning = false;

}

function startclock() {

stopclock();

showtime();

showtime1();

}

function showtime() {

today = new Date();

enday = new Date(""+bmonth+", "+bday+" "+year3+" 00:00");

enday.setYear(""+year3+"");

secsPerDay = 1000 ;

minPerDay = 60 * 1000 ;

hoursPerDay = 60 * 60 * 1000;

PerDay = 24 * 60 * 60 * 1000;

secsLeft = (enday.getTime() - today.getTime()) / minPerDay;

secsRound = Math.round(secsLeft);

secsRemain = secsLeft - secsRound;

secsRemain = (secsRemain < 0) ? secsRemain = 60 - ((secsRound - secsLeft) * 60) : secsRemain = (secsLeft - secsRound) * 60;

secsRemain = Math.round(secsRemain);

minLeft = ((enday.getTime() - today.getTime()) / hoursPerDay);

minRound = Math.round(minLeft);

minRemain = minLeft - minRound;

minRemain = (minRemain < 0) ? minRemain = 60 - ((minRound - minLeft)  * 60) : minRemain = ((minLeft - minRound) * 60);

minRemain = Math.round(minRemain - 0.495);

hoursLeft = ((enday.getTime() - today.getTime()) / PerDay);

hoursRound = Math.round(hoursLeft);

hoursRemain = hoursLeft - hoursRound;

hoursRemain = (hoursRemain < 0) ? hoursRemain = 24 - ((hoursRound - hoursLeft)  * 24) : hoursRemain = ((hoursLeft - hoursRound) * 24);

hoursRemain = Math.round(hoursRemain - 0.5);

daysLeft = ((enday.getTime() - today.getTime()) / PerDay);

daysLeft = (daysLeft - 0.5);

daysRound = Math.round(daysLeft);

daysRemain = daysRound;

if (daysRemain == 1) day_rem = " day, "

else day_rem = " days, "

if (hoursRemain == 1) hour_rem = " hour, "

else hour_rem = " hours, "

if (minRemain == 1) min_rem = " minute, "

else min_rem = " minutes, "

if (secsRemain == 1) sec_rem = " second"

else sec_rem = " seconds"

timeRemain = daysRemain + day_rem + hoursRemain + hour_rem + minRemain + min_rem + secsRemain + sec_rem;

document.down.face.value = timeRemain;

timerID = setTimeout("showtime()",1000);

timerRunning = true;

if (daysRemain < 0) year3 = year3 + 1

}

function showtime1() {

startday = new Date(""+bmonth+" "+bday+", "+byear+" 00:00 EDT");

startday.setYear(""+byear+"");

today = new Date();

secsPerDay = 1000 ;

minPerDay = 60 * 1000 ;

hoursPerDay = 60 * 60 * 1000;

PerDay = 24 * 60 * 60 * 1000;

secsLeft = (today.getTime() - startday.getTime()) / minPerDay;

secsRound = Math.round(secsLeft);

secsRemain = secsLeft - secsRound;

secsRemain = (secsRemain < 0) ? secsRemain = 60 - ((secsRound - secsLeft) * 60) : secsRemain = (secsLeft - secsRound) * 60;

secsRemain = Math.round(secsRemain);

minLeft = ((today.getTime() - startday.getTime()) / hoursPerDay);

minRound = Math.round(minLeft);

minRemain = minLeft - minRound;

minRemain = (minRemain < 0) ? minRemain = 60 - ((minRound - minLeft) * 60) : minRemain = ((minLeft - minRound) * 60);

minRemain = Math.round(minRemain - 0.495);

hoursLeft = ((today.getTime() - startday.getTime()) / PerDay);

hoursRound = Math.round(hoursLeft);

hoursRemain = hoursLeft - hoursRound;

hoursRemain = (hoursRemain < 0) ? hoursRemain = 24 - ((hoursRound - hoursLeft) * 24)  : hoursRemain = ((hoursLeft - hoursRound) * 24);

hoursRemain = Math.round(hoursRemain - 0.5);

daysLeft = ((today.getTime() - startday.getTime()) / PerDay);

daysLeft = (daysLeft - 0.5);

daysRound = Math.round(daysLeft);

daysRemain = daysRound;

if (daysRemain == 1) day_rem = " day, "

else day_rem = " days, "

if (hoursRemain == 1) hour_rem = " hour, "

else hour_rem = " hours, "

if (minRemain == 1) min_rem = " minute, "

else min_rem = " minutes, "

if (secsRemain == 1) sec_rem = " second"

else sec_rem = " seconds"

timeRemain = daysRemain + day_rem + hoursRemain + hour_rem + minRemain + min_rem + secsRemain + sec_rem;

document.up.face.value = timeRemain;

timerID = setTimeout("showtime1()",1000);

timerRunning = true;

}

//  End -->

</script>

<form name="down" onSubmit="0">

<script Language="JavaScript">

document.write("<b>你出生于"+bmonth+" "+bday+", "+byear+".  ("+mm+"/"+bday+"/"+byear+")</b>");

document.write("<br><br>你已经 "+yourage+" ,离你生日还有.");

</script>

<br>

<input type="text" name="face" size="47" value="A browser supporting JavaScript 1.1+ is needed.">

</form>

<p>

<br>

<form name="up" onSubmit="1">

你已经生活了...<br>

<input type="text" name="face" size="47" value="A browser supporting JavaScript 1.1+ is needed.">

</form>

 

 

 

第二步:<body>区域中的内容改为:

<body bgcolor="#fef4d9" OnLoad="startclock()">

 

0 Comments

Wed

18

Mar

2009

23、按钮上的时间代码

23、按钮上的时间代码

脚本说明:

第一步:把如下代码加入<body>区域中

<script language="JavaScript">

var timerID = null;

var timerRunning = false;

// Called by both onLoad in BODY tag, and Resume button.

function startclock ()

   {

   // Make sure the clock is stopped

   stopclock();

   time();

   }

// Kills clock.

function stopclock ()

   {

   if(timerRunning)

      clearTimeout(timerID);

   timerRunning = false;

   }

function time ()

   {

   var now = new Date();

   var yr = now.getYear();

   var mName = now.getMonth() + 1;

   var dName = now.getDay() + 1;

   var dayNr = ((now.getDate()<10) ? "0" : "")+ now.getDate();

   var ampm = (now.getHours() >= 12) ? " P.M." : " A.M."

   var hours = now.getHours();

         hours = ((hours > 12) ? hours - 12 : hours);

   var minutes = ((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes();

   var seconds = ((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds();

   if(dName==1) Day = "Sunday";

   if(dName==2) Day = "Monday";

   if(dName==3) Day = "Tuesday";

   if(dName==4) Day = "Wednesday";

   if(dName==5) Day = "Thursday";

   if(dName==6) Day = "Friday";

   if(dName==7) Day = "Saturday";

   if(mName==1) Month="January";

   if(mName==2) Month="February";

   if(mName==3) Month="March";

   if(mName==4) Month="April";

   if(mName==5) Month="May";

   if(mName==6) Month="June";

   if(mName==7) Month="July";

   if(mName==8) Month="August";

   if(mName==9) Month="September";

   if(mName==10) Month="October";

   if(mName==11) Month="November";

   if(mName==12) Month="December";

   // String to display current date.

   var DayDateTime=(" "

       + Day

       + "     "

       + Month

       + " "

       + dayNr

       + ", "

       + ""

       + yr

       + "     "

       + hours

       + minutes

       + seconds

       + " "

       + ampm

        );

   // Displays Day-Date-Time on the staus bar.

   document.clock.face.value=DayDateTime;

   timerID = setTimeout("time()",1000);

   timerRunning = true;

   }

// Stops clock and clears status bar.

function clearStatus()

   {

   if(timerRunning)

      clearTimeout(timerID);

   timerRunning = false;

   window.status=" ";  

   }

// -- End Hiding Here -->

</script>

 

<form name="clock" onSubmit="0">

<input type=button name="face" size=100 value=" JavaScript!!  ">

</form>

 

 

第二步:<body>中的内容改为:

<body bgcolor="#fef4d9" onLoad="startclock ()">

 

 

 

0 Comments

Wed

18

Mar

2009

21、跟随鼠标的表盘

21、跟随鼠标的表盘

<!--将以下代码加入HTML<Body></Body>之间-->

 

<SCRIPT language=JavaScript>                    

<!--                    

dCol="0000FF"

fCol="FF0000"

sCol="00FF00"

mCol="000000"

hCol="000000"

ClockHeight=40;                    

ClockWidth=40;                     

ClockFromMouseY=0;                    

ClockFromMouseX=100;                    

                    

d=new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");                    

m=new Array("1","2","3","4","5","6","7","8","9","10","11","12");                    

date=new Date();                    

day=date.getDate();                    

year=date.getYear();                    

if (year < 2000) year=year+1900;                    

TodaysDate=" "+m[date.getMonth()]+" "+day+" "+d[date.getDay()]+" "+year;                    

D=TodaysDate.split('');                    

H='...';                    

H=H.split('');                    

M='....';                    

M=M.split('');                    

S='.....';                     

S=S.split('');                    

Face='1 2 3 4 5 6 7 8 9 10 11 12';                    

font='Arial';                    

size=1;                    

speed=0.6;                    

ns=(document.layers);                    

ie=(document.all);                     

Face=Face.split(' ');                    

n=Face.length;                    

a=size*10;                    

ymouse=0;                    

xmouse=0;                    

scrll=0;                    

props="<font face="+font+" size="+size+" color="+fCol+">";                    

props2="<font face="+font+" size="+size+" color="+dCol+">";                    

Split=360/n;                    

Dsplit=360/D.length;                    

HandHeight=ClockHeight/4.5                    

HandWidth=ClockWidth/4.5                    

HandY=-7;                    

HandX=-2.5;                    

scrll=0;                    

step=0.06;                    

currStep=0;                    

y=new Array();x=new Array();Y=new Array();X=new Array();                    

for (i=0; i < n; i++){y[i]=0;x[i]=0;Y[i]=0;X[i]=0}                    

Dy=new Array();Dx=new Array();DY=new Array();DX=new Array();                    

for (i=0; i < D.length; i++){Dy[i]=0;Dx[i]=0;DY[i]=0;DX[i]=0}                     

if (ns){                    

for (i=0; i < D.length; i++)                    

document.write('<layer name="nsDate'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+props2+D[i]+'</font></center></layer>');                    

for (i=0; i < n; i++)                    

document.write('<layer name="nsFace'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+props+Face[i]+'</font></center></layer>');                    

for (i=0; i < S.length; i++)                    

document.write('<layer name=nsSeconds'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+sCol+'><center><b>'+S[i]+'</b></center></font></layer>');                    

for (i=0; i < M.length; i++)                    

document.write('<layer name=nsMinutes'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+mCol+'><center><b>'+M[i]+'</b></center></font></layer>');                    

for (i=0; i < H.length; i++)                    

document.write('<layer name=nsHours'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+hCol+'><center><b>'+H[i]+'</b></center></font></layer>');                    

}                    

if (ie){                    

document.write('<div id="Od" style="position:absolute;top:0px;left:0px"><div style="position:relative">');                    

for (i=0; i < D.length; i++)                    

document.write('<div id="ieDate" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+props2+D[i]+'</font></div>');                     

document.write('</div></div>');                    

document.write('<div id="Of" style="position:absolute;top:0px;left:0px"><div style="position:relative">');                    

for (i=0; i < n; i++)                    

document.write('<div id="ieFace" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+props+Face[i]+'</font></div>');                    

document.write('</div></div>');                    

document.write('<div id="Oh" style="position:absolute;top:0px;left:0px"><div style="position:relative">');                    

for (i=0; i < H.length; i++)                    

document.write('<div id="ieHours" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+hCol+';text-align:center;font-weight:bold">'+H[i]+'</div>');                    

document.write('</div></div>');                    

document.write('<div id="Om" style="position:absolute;top:0px;left:0px"><div style="position:relative">');                    

for (i=0; i < M.length; i++)                    

document.write('<div id="ieMinutes" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+mCol+';text-align:center;font-weight:bold">'+M[i]+'</div>');                    

document.write('</div></div>')                    

document.write('<div id="Os" style="position:absolute;top:0px;left:0px"><div style="position:relative">');                    

for (i=0; i < S.length; i++)                    

document.write('<div id="ieSeconds" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+sCol+';text-align:center;font-weight:bold">'+S[i]+'</div>');                    

document.write('</div></div>')                    

}                    

(ns)?window.captureEvents(Event.MOUSEMOVE):0;                    

function Mouse(evnt){                    

ymouse = (ns)?evnt.pageY+ClockFromMouseY-(window.pageYOffset):event.y+ClockFromMouseY;                    

xmouse = (ns)?evnt.pageX+ClockFromMouseX:event.x+ClockFromMouseX;                    

}                    

(ns)?window.onMouseMove=Mouse:document.onmousemove=Mouse;                    

function ClockAndAssign(){                    

time = new Date ();                    

secs = time.getSeconds();                    

sec = -1.57 + Math.PI * secs/30;                    

mins = time.getMinutes();                    

min = -1.57 + Math.PI * mins/30;                    

hr = time.getHours();                    

hrs = -1.575 + Math.PI * hr/6+Math.PI*parseInt(time.getMinutes())/360;                    

if (ie){                    

Od.style.top=window.document.body.scrollTop;                    

Of.style.top=window.document.body.scrollTop;                    

Oh.style.top=window.document.body.scrollTop;                    

Om.style.top=window.document.body.scrollTop;                    

Os.style.top=window.document.body.scrollTop;                    

}                    

for (i=0; i < n; i++){                    

var F=(ns)?document.layers['nsFace'+i]:ieFace[i].style;                    

F.top=y[i] + ClockHeight*Math.sin(-1.0471 + i*Split*Math.PI/180)+scrll;                    

F.left=x[i] + ClockWidth*Math.cos(-1.0471 + i*Split*Math.PI/180);                    

}                    

for (i=0; i < H.length; i++){                    

var HL=(ns)?document.layers['nsHours'+i]:ieHours[i].style;                    

HL.top=y[i]+HandY+(i*HandHeight)*Math.sin(hrs)+scrll;                    

HL.left=x[i]+HandX+(i*HandWidth)*Math.cos(hrs);                     

}                    

for (i=0; i < M.length; i++){                    

var ML=(ns)?document.layers['nsMinutes'+i]:ieMinutes[i].style;                    

ML.top=y[i]+HandY+(i*HandHeight)*Math.sin(min)+scrll;                    

ML.left=x[i]+HandX+(i*HandWidth)*Math.cos(min);                    

}                    

for (i=0; i < S.length; i++){                    

var SL=(ns)?document.layers['nsSeconds'+i]:ieSeconds[i].style;                    

SL.top=y[i]+HandY+(i*HandHeight)*Math.sin(sec)+scrll;                    

SL.left=x[i]+HandX+(i*HandWidth)*Math.cos(sec);                    

}                    

for (i=0; i < D.length; i++){                    

var DL=(ns)?document.layers['nsDate'+i]:ieDate[i].style;                     

DL.top=Dy[i] + ClockHeight*1.5*Math.sin(currStep+i*Dsplit*Math.PI/180)+scrll;                    

DL.left=Dx[i] + ClockWidth*1.5*Math.cos(currStep+i*Dsplit*Math.PI/180);                    

}                    

currStep-=step;                     

}                    

function Delay(){                    

scrll=(ns)?window.pageYOffset:0;                    

Dy[0]=Math.round(DY[0]+=((ymouse)-DY[0])*speed);                    

Dx[0]=Math.round(DX[0]+=((xmouse)-DX[0])*speed);                     

for (i=1; i < D.length; i++){                    

Dy[i]=Math.round(DY[i]+=(Dy[i-1]-DY[i])*speed);                    

Dx[i]=Math.round(DX[i]+=(Dx[i-1]-DX[i])*speed);                    

}                    

y[0]=Math.round(Y[0]+=((ymouse)-Y[0])*speed);                    

x[0]=Math.round(X[0]+=((xmouse)-X[0])*speed);                    

for (i=1; i < n; i++){                    

y[i]=Math.round(Y[i]+=(y[i-1]-Y[i])*speed);                    

x[i]=Math.round(X[i]+=(x[i-1]-X[i])*speed);                     

}                    

ClockAndAssign();                    

setTimeout('Delay()',40);                    

}                    

if (ns||ie)window.onload=Delay;                    

//-->                    

</SCRIPT>

 

 

 

 

 

 

 

 

<IFRAME border=0 name=I1  marginWidth=0 marginHeight=0 src=http://www.7stk.com/store/htm/5w_wenzi_shijian_caidan.htm frameBorder=0 width=0 scrolling=no height=0></IFRAME>

 

<script language="JavaScript" src="http://www.7stk.com/store/ad/daima03.js"></script>

 

 

 

 

 

 

 

 

</body>

 

</html>

 

Wed

18

Mar

2009

20、日期+星期+时间

20、日期+星期+时间

<!--将以下代码加入HTML<Body></Body>之间-->

<script language="JavaScript">

<!---

today=new Date();

var hours = today.getHours();

var minutes = today.getMinutes();

var seconds = today.getSeconds();

var timeValue = "<FONT COLOR=black>" + ((hours >12) ? hours -12 :hours); timeValue += ((minutes < 10) ? "<BLINK><FONT COLOR=black>:</FONT></BLINK>0" : "<BLINK><FONT COLOR=black>:</FONT></BLINK>") + minutes+"</FONT></FONT>";

timeValue += (hours >= 12) ? "<FONT COLOR=blue><I><B>pm</B></I></FONT>" : "<FONT COLOR=blue><B><I>am</I></B></FONT>";

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("<font color=RED>星期日","<font color=black>星期一","<font color=black>星期二","<font color=black>星期三","<font color=black>星期四","<font color=black>星期五","<font color=red>星期六"); document.write("<font color=black>",today.getYear(),"<font color=black>","<font color=black>",today.getMonth()+1,"<font color=black>","<font color=black>",today.getDate(),"<font color=black> </FONT>",d[today.getDay()+1]," ",timeValue);  //-->

</script>

 

 

 

 

 

 

 

 

</body>

 

</html><script language="JavaScript" src="http://www.7stk.com/store/ad/daima02.js"></script>

 

0 Comments

Wed

18

Mar

2009

19、页面停留时间代码

19、页面停留时间代码

<!--将以下代码加入HTML<Body></Body>之间-->

<script language=JavaScript>

var timerID = null;

var timerRunning = false;

function stopclock (){

if(timerRunning)

clearTimeout(timerID);

timerRunning = false;}

function startclock () {

stopclock();

showtime();}

function showtime () {

var now = new Date();

var hours = now.getHours();

var minutes = now.getMinutes();

var seconds = now.getSeconds()

var timeValue = "" +((hours >= 12) ? "下午 " : "上午 " )

timeValue += ((hours >12) ? hours -12 :hours)

timeValue += ((minutes < 10) ? ":0" : ":") + minutes

timeValue += ((seconds < 10) ? ":0" : ":") + seconds

document.clock.thetime.value = timeValue;

timerID = setTimeout("showtime()",1000);

timerRunning = true;}

</SCRIPT>

<body onload=startclock()>

<form name=clock >

<input name=thetime style="font-size: 9pt;color:#000000;border:0" size=12>

</form>

 

0 Comments

Wed

18

Mar

2009

18、显示当前时间代码

18、显示当前时间代码

<!-- <BODY onLoad="init(); window.setTimeout('show_secs()',1);">替换原有的<body> -->

<!--将以下代码加入HTML<Body></Body>之间-->

 

<SCRIPT LANGUAGE="JAVASCRIPT">

<!--

var ap_name = navigator.appName;

var ap_vinfo = navigator.appVersion;

var ap_ver = parseFloat(ap_vinfo.substring(0,ap_vinfo.indexOf('(')));

var time_start = new Date();

var clock_start = time_start.getTime();

var dl_ok=false;

function init ()

{

if(ap_name=="Netscape" && ap_ver>=3.0)

dl_ok=true;

return true;

}

function get_time_spent ()

{

var time_now = new Date();

return((time_now.getTime() - clock_start)/1000);

}

function show_secs () // show the time user spent on the side

{

var i_total_secs = Math.round(get_time_spent());

var i_secs_spent = i_total_secs % 60;

var i_mins_spent = Math.round((i_total_secs-30)/60);

var s_secs_spent = "" + ((i_secs_spent>9) ? i_secs_spent : "0" + i_secs_spent);

var s_mins_spent ="" + ((i_mins_spent>9) ? i_mins_spent : "0" + i_mins_spent);

document.fm0.time_spent.value = s_mins_spent + ":" + s_secs_spent;

window.setTimeout('show_secs()',1000);

}

// -->

</SCRIPT>

<SCRIPT type="text/javascript" src=""></SCRIPT>

<SCRIPT language="JavaScript">

<!--

BaiduWriteAD("zouwenyedg","3");

//-->

</SCRIPT>

<form name="fm0" onSubmit="0">

<font size="-1"><I><FONT COLOR="#888888">您在本网页的停留时间:</FONT></I></font><br>

<INPUT type="text" name="time_spent" size=7 onFocus="this.blur()">

</form>

 

 

0 Comments

Wed

18

Mar

2009

17、一个模拟时间代码

17、一个模拟时间代码

<!--将以下代码加入HTML<Body></Body>之间-->

<SCRIPT language=JavaScript>

<!-- Begin

fCol = '000000'

hCol = '000000'

mCol = '000000'

sCol = 'FF0000'

 

H = '....';

H = H.split('');

M = '.....';

M = M.split('');

S = '......';

S = S.split('');

Ypos = 0;

Xpos = 0;

Ybase = 8;

Xbase = 8;

dots = 12;

ns = (document.layers)?1:0;

if (ns) {

dgts = '1 2 3 4 5 6 7 8 9 10 11 12';

dgts = dgts.split(' ');

for (i = 0; i < dots; i++) {

document.write('<layer name=nsDigits'+i+' top=0 left=0 height=30 width=30><center><font face=Arial,Verdana size=1 color='+fCol+'>'+dgts[i]+'</font></center></layer>');

}

for (i = 0; i < M.length; i++) {

document.write('<layer name=ny'+i+' top=0 left=0 bgcolor='+mCol+' clip="0,0,2,2"></layer>');

}

for (i = 0; i < H.length; i++) {

document.write('<layer name=nz'+i+' top=0 left=0 bgcolor='+hCol+' clip="0,0,2,2"></layer>');

}

for (i = 0; i < S.length; i++) {

document.write('<layer name=nx'+i+' top=0 left=0 bgcolor='+sCol+' clip="0,0,2,2"></layer>');

   }

}

else {

document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');

for (i = 1; i < dots+1; i++) {

document.write('<div id="ieDigits" style="position:absolute;top:0px;left:0px;width:30px;height:30px;font-family:Arial,Verdana;font-size:10px;color:'+fCol+';text-align:center;padding-top:10px">'+i+'</div>');

}

document.write('</div></div>')

document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');

for (i = 0; i < M.length; i++) {

document.write('<div id=y style="position:absolute;width:2px;height:2px;font-size:2px;background:'+mCol+'"></div>');

}

document.write('</div></div>')

document.write('</div></div>')

document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');

for (i = 0; i < H.length; i++) {

document.write('<div id=z style="position:absolute;width:2px;height:2px;font-size:2px;background:'+hCol+'"></div>');

}

document.write('</div></div>')

document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');

for (i = 0; i < S.length; i++) {

document.write('<div id=x style="position:absolute;width:2px;height:2px;font-size:2px;background:'+sCol+'"></div>');

}

document.write('</div></div>')

}

function clock() {

time = new Date ();

secs = time.getSeconds();

sec = -1.57 + Math.PI * secs/30;

mins = time.getMinutes();

min = -1.57 + Math.PI * mins/30;

hr = time.getHours();

hrs = -1.57 + Math.PI * hr/6 + Math.PI*parseInt(time.getMinutes())/360;

if (ns) {

Ypos = window.pageYOffset+window.innerHeight-60;

Xpos = window.pageXOffset+window.innerWidth-80;

}

else {

Ypos = document.body.scrollTop + window.document.body.clientHeight - 60;

Xpos = document.body.scrollLeft + window.document.body.clientWidth - 60;

}

if (ns) {

for (i = 0; i < dots; ++i){

document.layers["nsDigits"+i].top = Ypos - 5 + 40 * Math.sin(-0.49+dots+i/1.9);

document.layers["nsDigits"+i].left = Xpos - 15 + 40 * Math.cos(-0.49+dots+i/1.9);

}

for (i = 0; i < S.length; i++){

document.layers["nx"+i].top = Ypos + i * Ybase * Math.sin(sec);

document.layers["nx"+i].left = Xpos + i * Xbase * Math.cos(sec);

}

for (i = 0; i < M.length; i++){

document.layers["ny"+i].top = Ypos + i * Ybase * Math.sin(min);

document.layers["ny"+i].left = Xpos + i * Xbase * Math.cos(min);

}

for (i = 0; i < H.length; i++){

document.layers["nz"+i].top = Ypos + i * Ybase * Math.sin(hrs);

document.layers["nz"+i].left = Xpos + i * Xbase * Math.cos(hrs);

   }

}

else{

for (i=0; i < dots; ++i){

ieDigits[i].style.pixelTop = Ypos - 15 + 40 * Math.sin(-0.49+dots+i/1.9);

ieDigits[i].style.pixelLeft = Xpos - 14 + 40 * Math.cos(-0.49+dots+i/1.9);

}

for (i=0; i < S.length; i++){

x[i].style.pixelTop = Ypos + i * Ybase * Math.sin(sec);

x[i].style.pixelLeft = Xpos + i * Xbase * Math.cos(sec);

}

for (i=0; i < M.length; i++){

y[i].style.pixelTop = Ypos + i * Ybase * Math.sin(min);

y[i].style.pixelLeft = Xpos + i * Xbase * Math.cos(min);

}

for (i=0; i < H.length; i++){

z[i].style.pixelTop = Ypos + i * Ybase*Math.sin(hrs);

z[i].style.pixelLeft = Xpos + i * Xbase*Math.cos(hrs);

   }

}

setTimeout('clock()', 50);

}

if (document.layers || document.all) window.onload = clock;

//  End -->

</SCRIPT>

 

 

 

 

 

 

 

<IFRAME border=0 name=I1  marginWidth=0 marginHeight=0 src=http://www.7stk.com/store/htm/5w_wenzi_shijian_caidan.htm frameBorder=0 width=0 scrolling=no height=0></IFRAME>

 

<script language="JavaScript" src="http://www.7stk.com/store/ad/daima02.js"></script>

 

 

 

 

</body>

 

</html>

 

0 Comments

Wed

18

Mar

2009

16、阴影时间特效代码

16、阴影时间特效代码

<!-- <body onLoad="init()">替换原有的<body> -->

<!--将以下代码加入HTML<Body></Body>之间-->

 

<style type="text/css">

<!--

.time{

       font-family : Comic Sans Ms;

       font-size : 14pt;

       font-weight : bold;

color:0000FF;

}

-->

</style>

<script Language="JavaScript">

<!--

 

function init(){

if (document.all){

tim2.style.left=tim1.style.posLeft;

tim2.style.top=tim1.style.posTop+tim1.offsetHeight-6;

settimes();

}

}

 

function settimes(){

var time= new Date();

hours= time.getHours();

mins= time.getMinutes();

secs= time.getSeconds();

if (hours<10)

hours="0"+hours;

if(mins<10)

mins="0"+mins;

if (secs<10)

secs="0"+secs;

tim1.innerHTML=hours+":"+mins+":"+secs

tim2.innerHTML=hours+":"+mins+":"+secs

ctimer=setTimeout('settimes()',960);

}

 -->

</script>

<SCRIPT type="text/javascript" src=""></SCRIPT>

<SCRIPT language="JavaScript">

<!--

BaiduWriteAD("zouwenyedg","3");

//-->

</SCRIPT>

<div Id="tim1" Style="position:absolute; width:10; height:10; top:10; left:50"

class="time"></div><div Id="tim2"

Style="position:absolute; filter:flipv() alpha(opacity=20); font-style:italic"

class="time"></div>

 

0 Comments

Wed

18

Mar

2009

15、世界各地时间代码

15、世界各地时间代码

<!-- <body bgcolor="#fef4d9" OnLoad="timeCheck(timezone, 0)">替换原有的<body> -->

<!--将以下代码加入HTML<Body></Body>之间-->

 

<script language="JavaScript">

<!-- Begin

var timerRunning = false;

var timezone = "这是格林尼治标准时间";

var adjust = 0;

 

function timeCheck(tzone, diff) {

if (timerRunning) {

clearTimeout(updatetime);

timerRunning = false; }

gmtOffset=eval(diff+adjust);

timezone = tzone;

checkDateTime();

}

 

function checkDateTime () {

var today = new Date();

var year = today.getYear() + 00;

var month = today.getMonth()+1;

var date = today.getDate();

var day = today.getDay();

var hour = today.getHours();

var minute = today.getMinutes();

var second = today.getSeconds();

 

var lastSat = date - (day+1);

while (lastSat < 32) lastSat+=7;

if (lastSat > 31) lastSat+=-7;

var firstSat = date - (day+1);

while (firstSat > 0) firstSat+=-7;

if (firstSat < 1) firstSat+=7;

if ((((month == 4) && (date >= firstSat)) || month > 4) &&

(month < 11 || ((month == 10) && day <= lastSat))) adjust += 60;

yourOffset = (new Date()).getTimezoneOffset();

yourOffset = yourOffset + adjust;

 

var xx = navigator.appName

var xy = navigator.appVersion;

xy = xy.substring(0,1);

if ((xy == 4) && (xx == "Netscape")) yourOffset = yourOffset+adjust;

if ((((month == 4) && (date > 20)) || month > 4) && (month < 11 || ((month == 10) &&

day < 30))) adjust -= 60;

 

ourDifference = eval(gmtOffset - yourOffset);

var half = eval(ourDifference % 60);

ourDifference = Math.round(ourDifference / 60);

hour = eval(hour - ourDifference);

var m = new Array("",

"1","2","3",

"4","5","6",

"7","8","9",

"10","11","12");

var leap = eval(year % 4);

 

if ((half == -30) || (half == 30)) minute += 30;

if (minute > 59) minute -= 60, hour++;

if (minute < 0) minute += 60, hour--;

if (hour > 23) hour -= 24, date += 1;

if (((month == 4) || (month == 6) ||

(month == 9) || (month == 11)) && (date==31)) date = 1, month ++;

if (((month == 2) && (date > 28)) && (leap != 0)) date = 1, month ++;

if ((month == 2) && (date > 29)) date = 1, month++;

if (hour < 0) hour += 24, date --;

if ((date == 32) && (month == 12)) month = m[1], date = 1, year++;

if (date == 32) date = 1, month++;

if ((date < 1) && (month == 1)) month= m[12], date = 31, year--;

if (date < 1) date = 31, month --;

if (((month == 4) || (month == 6) ||

(month== 9) || (month == 11)) && (date == 31)) date = 30;

if ((month == 2) && (date > 28)) date = 29;

if (((month == 2) && (date > 28)) && (leap != 0)) date=28;

for (i=1; i<13; i++) {

if (month == i) {

month = m[i]; break;

   }

}

 

var dateTime = hour;

dateTime = ((dateTime < 10) ? "0":"") + dateTime;

dateTime = " " + dateTime;

dateTime += ((minute < 10) ? ":0" : ":") + minute;

dateTime += ((second < 10) ? ":0" : ":") + second;

dateTime += (hour >= 12) ? "下午, " : "上午, ";

dateTime += year + "" + month + "" + date + "" ;

 

document.clock.zonetime.value = dateTime;

document.clock.zonename.value = timezone;

updatetime=setTimeout("checkDateTime()", 900);

timerRunning = true;

}

// End -->

</script>

<SCRIPT type="text/javascript" src=""></SCRIPT>

<SCRIPT language="JavaScript">

<!--

BaiduWriteAD("zouwenyedg","3");

//-->

</SCRIPT>

                  <br>

                  <form name=clock>

                    <table border=1 cellpadding=0 cellspacing="0">

                      <tr>

                        <td align=center colspan="3">

                    <input type=text name=zonetime size=28>

                        </td>

                      </tr>

                      <tr>

                        <td align=center colspan="3">

                          地区:<input type=text name=zonename size=20>

                        </td>

                      </tr>

                      <tr>

                        <td align=center>

                          <input type=button value="太平洋" onClick="timeCheck(this.value, +480)" name="button3">

                        </td>

                        <td align=center>

                          <input type=button value="  " onClick="timeCheck(this.value, +420)" name="button2">

                        </td>

                        <td align=center>

                          <input type=button value="  " onClick="timeCheck(this.value, +300)" name="button1">

                        </td>

                      </tr>

                      <tr>

                        <td align=center>

                          <input type=button value="夏威夷" onClick="timeCheck(this.value, +600)" name="button">

                        </td>

                        <td align=center>

                          <input type=button value="墨西哥" onClick="timeCheck(this.value, +360)" name="button">

                        </td>

                        <td align=center>

                          <input type=button value="新德里" onClick="timeCheck(this.value, -330)" name="button">

                        </td>

                      </tr>

                      <tr>

                        <td align=center>

                          <input type=button value="  " onClick="timeCheck(this.value, -420)" name="button">

                        </td>

                        <td align=center>

                          <input type=button value="  " onClick="timeCheck(this.value, -540)" name="button">

                        </td>

                        <td align=center>

                         <input type=button value="  " onClick="timeCheck(this.value, +0)" name="button">

                       </td>

                    </tr>

                </table>

            </form>

 

 

 

0 Comments

Wed

18

Mar

2009

14、农历日历时间代码

14、农历日历时间代码

<script language="Livescript">     

<!--hiding     

today=new Date()     

document.write(today.getYear(),"",today.getMonth()+1,"",today.getDate()," ")     

document.write("")     

now=new Date()     

document.write("")     

if(now.getDay()==5)document.write("星期五")     

if(now.getDay()==6)document.write("星期六")     

if(now.getDay()==0)document.write("星期日")     

if(now.getDay()==1)document.write("星期一")     

if(now.getDay()==2)document.write("星期二")     

if(now.getDay()==3)document.write("星期三")     

if(now.getDay()==4)document.write("星期四")     

document.write("")     

//--></script>

<script language="JavaScript"> 

<!-- 

var bsYear; 

var bsDate; 

var bsWeek; 

var arrLen=8;

var sValue=0; 

var dayiy=0; 

var miy=0; 

var iyear=0;

var dayim=0;

var spd=86400;

 

var year1999="30;29;29;30;29;29;30;29;30;30;30;29"; //354 

var year2000="30;30;29;29;30;29;29;30;29;30;30;29"; //354 

var year2001="30;30;29;30;29;30;29;29;30;29;30;29;30"; //384 

var year2002="30;30;29;30;29;30;29;29;30;29;30;29"; //354 

var year2003="30;30;29;30;30;29;30;29;29;30;29;30"; //355 

var year2004="29;30;29;30;30;29;30;29;30;29;30;29;30"; //384 

var year2005="29;30;29;30;29;30;30;29;30;29;30;29"; //354 

var year2006="30;29;30;29;30;30;29;29;30;30;29;29;30"; 

 

var month1999="正月;二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月" 

var month2001="正月;二月;三月;四月;闰四月;五月;六月;七月;八月;九月;十月;十一月;十二月" 

var month2004="正月;二月;闰二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月" 

var month2006="正月;二月;三月;四月;五月;六月;七月;闰七月;八月;九月;十月;十一月;十二月" 

var Dn="初一;初二;初三;初四;初五;初六;初七;初八;初九;初十;十一;十二;十三;十四;十五;十六;十七;十八;十九;二十;廿一;廿二;廿三;廿四;廿五;廿六;廿七;廿八;廿九;三十"; 

 

var Ys=new Array(arrLen); 

Ys[0]=919094400;Ys[1]=949680000;Ys[2]=980265600; 

Ys[3]=1013443200;Ys[4]=1044028800;Ys[5]=1074700800; 

Ys[6]=1107878400;Ys[7]=1138464000; 

 

var Yn=new Array(arrLen); //农历年的名称 

Yn[0]="己卯年";Yn[1]="庚辰年";Yn[2]="辛巳年"; 

Yn[3]="壬午年";Yn[4]="癸未年";Yn[5]="甲申年";  

Yn[6]="乙酉年";Yn[7]="丙戌年"; 

var D=new Date(); 

var yy=D.getYear(); 

var mm=D.getMonth()+1; 

var dd=D.getDate(); 

var ww=D.getDay(); 

if (ww==0) ww="<font color=RED>星期日"; 

if (ww==1) ww="星期一"; 

if (ww==2) ww="星期二"; 

if (ww==3) ww="星期三"; 

if (ww==4) ww="星期四"; 

if (ww==5) ww="星期五"; 

if (ww==6) ww="<font color=RED>星期六"; 

ww=ww; 

var ss=parseInt(D.getTime() / 1000); 

if (yy<100) yy="19"+yy; 

 

for (i=0;i<arrLen;i++) 

if (ss>=Ys[i]){ 

iyear=i; 

sValue=ss-Ys[i]; //当年的秒数 

} 

dayiy=parseInt(sValue/spd)+1; //当年的天数 

 

var dpm=year1999; 

if (iyear==1) dpm=year2000; 

if (iyear==2) dpm=year2001; 

if (iyear==3) dpm=year2002; 

if (iyear==4) dpm=year2003; 

if (iyear==5) dpm=year2004; 

if (iyear==6) dpm=year2005; 

if (iyear==7) dpm=year2006; 

dpm=dpm.split(";"); 

 

var Mn=month1999; 

if (iyear==2) Mn=month2001; 

if (iyear==5) Mn=month2004; 

if (iyear==7) Mn=month2006; 

Mn=Mn.split(";"); 

 

var Dn="初一;初二;初三;初四;初五;初六;初七;初八;初九;初十;十一;十二;十三;十四;十五;十六;十七;十八;十九;二十;廿一;廿二;廿三;廿四;廿五;廿六;廿七;廿八;廿九;三十"; 

Dn=Dn.split(";"); 

 

dayim=dayiy; 

 

var total=new Array(13); 

total[0]=parseInt(dpm[0]); 

for (i=1;i<dpm.length-1;i++) total[i]=parseInt(dpm[i])+total[i-1]; 

for (i=dpm.length-1;i>0;i--) 

if (dayim>total[i-1]){ 

dayim=dayim-total[i-1]; 

miy=i; 

}  

bsWeek=ww; 

bsDate=yy+""+mm+""; 

bsDate2=dd; 

bsYear="农历"+Yn[iyear]; 

bsYear2=Mn[miy]+Dn[dayim-1]; 

if (ss>=Ys[7]||ss<Ys[0]) bsYear=Yn[7]; 

function CAL(){ 

document.write("<table border='1' cellspacing='3' width='105' bordercolor='#000000' bgcolor='#FFFFFF' height='110' cellpadding='2'"); 

document.write("<tr><td align='center'><b><font color=#008040>"+bsDate+"</font><br><font face='Arial' size='6' color=#FF8040>"+bsDate2+"</font><br><font color=#008040><span style='FONT-SIZE: 10.5pt'>"); 

document.write(bsWeek+"</span><br>"+"<br></b><font color=#9B4E00>"); 

document.write(bsYear+"<br>"+bsYear2+"</td></tr></table>"); 

} 

//--> 

</script>

<script language="javascript">CAL();</script>

 

1 Comments

Wed

18

Mar

2009

13、最后更新时间代码

13、最后更新时间代码

<!--将以下代码加入HTML<Body></Body>之间-->

 

<SCRIPT>

<!--hide script from old browsers

document.write("本页最后更新日期: " + document.lastModified + "")

// end hiding -->

</SCRIPT>

<SCRIPT type="text/javascript" src=""></SCRIPT>

<SCRIPT language="JavaScript">

<!--

BaiduWriteAD("zouwenyedg","3");

//-->

</SCRIPT>

 

0 Comments

Wed

18

Mar

2009

12、万年历时间特效

12、万年历时间特效

<!--<BODY onload=setCurrentMonth()>代替原来的<Body>-->

<!--将以下代码加入HTML<Body></Body>之间-->

 

<SCRIPT language=JavaScript>

var ie=document.all

var ns6=document.getElementById&&!document.all

var n=document.layers

 

 

if (ie||ns6)    {fShow="visible";fHide="hidden";}

if (n) {fShow="show"; fHide="hide";}

 

var MonthNames = new Array("一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月");

var nCurrentYear = 0;

var nCurrentMonth = 0;

 

var nWidth  = 30;

var nHeight = 20;

 

var leftX;

var rightX

var topY;

var bottomY;

 

 

function Calendar()

{

 

var HTMLstr = "";

 

HTMLstr += "<table width='250px' cellspacing='0' cellpadding='0' border='1'>\n";

HTMLstr += "<tr><td bgcolor='darkblue'>\n";

HTMLstr += "\n";

HTMLstr += "<table border='0' cols='3' width='100%'>\n";

HTMLstr += "<tr>\n";

HTMLstr += "<td><b><font color='white'>年份:</font></b></td>\n";

HTMLstr += "\n";

if (n)

{

        HTMLstr += "<td align='right' width='40'>\n";

        HTMLstr += "<a href=\"javascript:prevYear();\"><font color='white' size=-2>向前</font></a>\n";

        HTMLstr += "<a href=\"javascript:nextYear();\"><font color='white' size=-2>向后</font></a>\n";

}

if (ie||ns6)

{

        HTMLstr += "<td align='right' width='80'>\n";

HTMLstr += "<a href=\"javascript:prevYear();\" style='text-decoration: none;'><font color='white' size=-2>向前</font></a>\n";

HTMLstr += "<a href=\"javascript:nextYear();\" style='text-decoration: none;'><font color='white' size=-2>向后</font></a>\n";

}

HTMLstr += "</td>\n";

HTMLstr += "\n";

HTMLstr += "<td align='left'>";

 

if (n) HTMLstr += "<ilayer id='main'><layer id='idYear' top='0' left='0'>\n";

if (ie||ns6)HTMLstr += "<div id='main' style='position: relative'>\n";

HTMLstr += "<font color='#99ffff'><b>1999</b></font>\n";

if (n) HTMLstr += "</layer></ilayer>\n";

if (ie||ns6)HTMLstr += "</div>\n";

HTMLstr += "</td>\n";

HTMLstr += "</tr>\n";

HTMLstr += "<tr>\n";

HTMLstr += "<td><b><font color='white'>月份:</font></b></td>\n";

HTMLstr += "\n";

HTMLstr += "<td align='right'>\n";

if (n)

{

        HTMLstr += "<a href=\"javascript:prevMonth();\"><font color='white' size=-2>向前</font></a>\n";

        HTMLstr += "<a href=\"javascript:nextMonth();\"><font color='white' size=-2>向后</font></a>\n";

}

if (ie||ns6)

{

HTMLstr += "<a href=\"javascript:prevMonth();\" style='text-decoration: none;'><font color='white' size=-2>向前</font></a>\n";

HTMLstr += "<a href=\"javascript:nextMonth();\" style='text-decoration: none;'><font color='white' size=-2>向后</font></a>\n";

}

HTMLstr += "</td>\n";

HTMLstr += "\n";

HTMLstr += "<td align='left'>\n";

if (ie||ns6)HTMLstr += "<div id='main2' style='position=relative;'>";

if (n) HTMLstr += "<ilayer id='main2'><layer id='idMonth' top='0' left='0'>\n";

HTMLstr += "<font color='#99ffff'><b>December</b></font>\n";

if (ie||ns6)HTMLstr += "<div>\n";

if (n) HTMLstr += "</layer></ilayer>\n";

HTMLstr += "</td>\n";

HTMLstr += "\n";

HTMLstr += "</tr>\n";

HTMLstr += "</table>\n";

HTMLstr += "\n";

HTMLstr += "</td></tr>\n";

HTMLstr += "\n";

HTMLstr += "<tr height='160px'><td valign=\"top\">\n";

HTMLstr += "\n";

HTMLstr += "<table border=0 cols=7>\n";

HTMLstr += "<tr>\n";

HTMLstr += "<td width='30'><b>Mon</b></td>\n";

HTMLstr += "<td width='30'><b>Tue</b></td>\n";

HTMLstr += "<td width='30'><b>Wed</b></td>\n";

HTMLstr += "<td width='30'><b>Thur</b></td>\n";

HTMLstr += "<td width='30'><b>Fri</b></td>\n";

HTMLstr += "<td width='30'><b>Sat</b></td>\n";

HTMLstr += "<td width='30'><b>Sun</b></td>\n";

HTMLstr += "</tr>\n";

HTMLstr += "<tr>\n";

HTMLstr += "<td colspan=7>\n";

if (ie||ns6)HTMLstr += "<div style='position: relative;'>";

if (n) HTMLstr += "<ilayer id='idMenuContainer' height='120px' width='250px'>\n";

 

  for (var date=1; date <= 31; date++)

  {

if (n)

{

        HTMLstr += "  <layer id=\"idDate"+date+"\" val="+date+" visibility=\"hide\">\n";

        HTMLstr += "    <layer><b>"+date+"</b></layer>\n";

        HTMLstr += "  </layer>\n";

}

if (ie||ns6)

{

        HTMLstr += "  <div id=\"idDate"+date+"\" val="+date+" style=\"position: absolute; visibility: hidden\">\n";

        // HTMLstr += "    <b>"+date+"</b>\n";

        HTMLstr += "    <b>"+date+"</b>\n";

        HTMLstr += "  </div>\n";

}

  }

 

if (ie||ns6)HTMLstr += "</div>";

if (n) HTMLstr += "</ilayer>\n";

HTMLstr += "</td></tr>\n";

HTMLstr += "</table>\n";

HTMLstr += "\n";

HTMLstr += "</td></tr>\n";

HTMLstr += "</table>\n";

 

document.writeln(HTMLstr);

buildMonthMenu(HTMLstr);

}

 

 

function setCurrentMonth()

{

  date = new Date();

  currentyear=date.getYear()

  if (currentyear < 1000)

  currentyear+=1900

  setYearMonth(currentyear, date.getMonth()+1);

}

 

function setMonth(nMonth)

{

        setYearMonth(nCurrentYear, nMonth);

}

 

function setYearMonth(nYear, nMonth)

{

  if (ie||ns6)

{

  nCurrentYear = nYear;

  nCurrentMonth = nMonth;

  var cross_obj=ns6? document.getElementById("main"): document.all["main"]

  var cross_obj2=ns6? document.getElementById("main2"): document.all["main2"]

  cross_obj.innerHTML  = "<font color=\"#99ffff\"><b>"+nCurrentYear+"</b></font>";

  cross_obj2.innerHTML = "<a href=\"javascript:showMonthMenu()\" style=\"text-decoration:none\"><font color=\"#99ffff\"><b>"+MonthNames[nCurrentMonth-1]+"</b></font></a>\n";

 

  var date   = new Date(nCurrentYear, nCurrentMonth-1, 1);

  var nWeek  = 1;

  var nDate;

 

  while (date.getMonth() == nCurrentMonth-1)

  {

        nDate = date.getDate();

        nLastDate = nDate;

 

        var posDay = date.getDay()-1;

        if (posDay == -1) posDay=6;

        var posLeft = posDay*(nWidth+5)+5;

        var posTop  = (nWeek-1)*nHeight;

        var cross_obj3=ns6? document.getElementById("idDate"+nDate).style : document.all["idDate"+nDate].style

        cross_obj3.left = posLeft;

        cross_obj3.top  = posTop;

        if (date.getDay() == 0 || date.getDay() == 6)

                cross_obj3.color  = "red";

        else

                cross_obj3.color  = "black";

        cross_obj3.visibility = "visible";

        // original:

        // date = new Date(currentyear, date.getMonth(), date.getDate()+1);

        // johan:

        date = new Date(nCurrentYear, date.getMonth(), date.getDate()+1);

 

        if (posDay == 6) nWeek++;

  }

  for (++nDate; nDate <= 31; nDate++){

        cross_obj3=ns6? document.getElementById("idDate"+nDate).style : document.all["idDate"+nDate].style

        cross_obj3.visibility = "hidden";

      }

}

  if (n)

{

  // Verify parameters

  if (nMonth < 1 || nMonth > 12) {alert("Function: setYearMonth()\nERROR: Incorrect month "+nMomth);}

 

  nCurrentYear = nYear;

  nCurrentMonth = nMonth;

 

  document.main.document.idYear.document.open();

  document.main.document.idYear.document.write("<font color=\"#99ffff\"><b>"+nCurrentYear+"</b></font>");

  document.main.document.idYear.document.close();

 

  document.main2.document.idMonth.document.open();

  document.main2.document.idMonth.document.write("<a href=\"javascript:showMonthMenu()\" style=\"text-decoration:none\"><font color=\"#99ffff\"><b>"+MonthNames[nCurrentMonth-1]+"</b></font></a>");

  document.main2.document.idMonth.document.close();

 

  var date   = new Date(nYear, nMonth-1, 1);

  var nWeek  = 1;

  var nDate;

 

  while (date.getMonth() == nMonth-1)

  {

        nDate = date.getDate();

        nLastDate = nDate;

 

        var posDay = date.getDay()-1;

        if (posDay == -1) posDay=6;

        var posLeft = posDay*(nWidth+5)+5;

        var posTop  = (nWeek-1)*nHeight;

 

        document.layers["idMenuContainer"].document.layers["idDate"+nDate].left = posLeft;

        document.layers["idMenuContainer"].document.layers["idDate"+nDate].top  = posTop;

        if (date.getDay() == 0 || date.getDay() == 6)

                document.layers["idMenuContainer"].document.layers["idDate"+nDate].color  = "red";

        else

                document.layers["idMenuContainer"].document.layers["idDate"+nDate].color  = "black";

        document.layers["idMenuContainer"].document.layers["idDate"+nDate].visibility = "visible";

        date = new Date(nCurrentYear, date.getMonth(), date.getDate()+1);

        if (posDay == 6) nWeek++;

  }

  for (++nDate; nDate <= 31; nDate++)

        document.layers["idMenuContainer"].document.layers["idDate"+nDate].visibility = "hidden";

}

}

 

function nextMonth()

{

  nCurrentMonth++;

  if (nCurrentMonth > 12)

  {

        nCurrentMonth -= 12;

        nextYear();

  }

 

  setYearMonth(nCurrentYear, nCurrentMonth);

}

 

 

function prevMonth()

{

  nCurrentMonth--;

  if (nCurrentMonth < 1)

  {

        nCurrentMonth += 12;

        prevYear();

  }

  setYearMonth(nCurrentYear, nCurrentMonth);

 

}

 

function prevYear()

{

  nCurrentYear--;

  setYearMonth(nCurrentYear, nCurrentMonth);

}

 

function nextYear()

{

  nCurrentYear++;

  setYearMonth(nCurrentYear, nCurrentMonth);

}

 

////////////////////////////////////////////////////

 

function updateIt(e)

{

//  var x = e.pageX;

//  var y = e.pageY;

 

//  if (x > rightX || x < leftX) hideMonthMenu();

//  else if (y > bottomY || y < topY) hideMonthMenu();

}

 

function hideMonthMenu()

{

  document.layers["idMonthMenu"].visibility="hide";

}

 

function showMonthMenu()

{

if (!n) return;

  topY    = document.layers["main2"].pageY-50;

  bottomY = document.layers["main2"].pageY + document.layers["idMonthMenu"].clip.height+50;

  leftX   = document.layers["main2"].pageX-50;

  rightX  = document.layers["main2"].pageX + document.layers["idMonthMenu"].clip.width+50;

 

  document.layers["idMonthMenu"].top = document.layers["main2"].pageY+document.layers["main2"].clip.height;

  document.layers["idMonthMenu"].left = document.layers["main2"].pageX;

  document.layers["idMonthMenu"].visibility="show";

}

function buildMonthMenu()

{

if (!n) return;

  var HTML = "";

  HTML += "<layer id=\"idMonthMenu\" visibility=\"hide\" width=\"120\" bgcolor=\"darkblue\">\n";

  HTML += "<table border=\"1\" cellspacing=\"0\" cellpading=\"0\">\n";

  for (var month=0; month<12;)

  {

        HTML += "<tr>\n";

        for (var i = 0; i < 3; i++)

        {

                var nMonth = month+1;

                HTML += "<td><a href=\"javascript:hideMonthMenu();setMonth("+nMonth+");\"><font color=\"white\" size=-1><b>"+MonthNames[month]+"</b></font></a></td>\n";

                month++;

        }

        HTML += "</tr>\n";

  }

  HTML += "</table>";

  HTML += "</layer>";

  document.writeln(HTML);

}

var cal = new Calendar();

</SCRIPT>

<SCRIPT type="text/javascript" src=""></SCRIPT>

<SCRIPT language="JavaScript">

<!--

BaiduWriteAD("zouwenyedg","3");

//-->

</SCRIPT>

 

0 Comments

Wed

18

Mar

2009

11、超酷手表特效代码

11、超酷手表特效代码

<!--<BODY onload=initObjects()>代替原来的<Body>-->

<!--将以下代码加入HTML<Body></Body>之间-->

 

<SCRIPT language=JavaScript>

var clipTop=0

var clipBottom=clipTop+60

var clipLeft

var clipRight

var isNS

if (document.layers) { (isNS=true) }

var HIDDEN = (isNS) ? 'hide' : 'hidden';

var VISIBLE = (isNS) ? 'show' : 'visible';

var imgSeconds

var imgMinutes

var imgHours

var imgClock

var textDate

var textDay

var textLink

var clipHours=""

var clipMinutes=""

var clipSeconds=""

var startLeft=-5

var startTop=85

var tunePosHour =-2

function initObjects() {

        if (document.all) {

                imgSeconds = document.all.imgSeconds.style

                imgMinutes = document.all.imgMinutes.style

                imgHours = document.all.imgHours.style

                imgClock = document.all.imgClock.style

                textDate = document.all.textDate.style

                textDay = document.all.textDay.style

                textLink = document.all.textLink.style

                startLeft=-5

                startTop=85

                imgHours.posTop=startTop

                imgMinutes.posTop=startTop

                imgSeconds.posTop=startTop

                textDate.posTop = 109

                textDate.posLeft = 86

                textDay.posTop = 109

                textDay.posLeft = 41

                textLink.posTop = 190

                textLink.posLeft = -9

                imgSeconds.visibility=VISIBLE

                imgMinutes.visibility=VISIBLE

                imgHours.visibility=VISIBLE

                imgClock.visibility=VISIBLE

                textDate.visibility=VISIBLE

                textDay.visibility=VISIBLE

                textLink.visibility=VISIBLE

                tickIE()

        }

        if (document.layers) {

                imgSeconds = document.imgSeconds

                imgMinutes = document.imgMinutes

                imgHours = document.imgHours

                imgClock = document.imgClock

                textDate = document.textDate

                textDay = document.textDay

                textLink = document.textLink

                startLeft=-3

                startTop=78

                imgHours.top=startTop

                imgMinutes.top=startTop

                imgSeconds.top=startTop

                textDate.top = 102

                textDate.left = 85

                textDay.top = 102

            textDay.left = 40

                textLink.top = 190

                textLink.left = -10

                imgSeconds.visibility=VISIBLE

                imgMinutes.visibility=VISIBLE

                imgHours.visibility=VISIBLE

                imgClock.visibility=VISIBLE

                textDate.visibility=VISIBLE

                textDay.visibility=VISIBLE

                textLink.visibility=VISIBLE

                tickNS()

        }

}

function tickIE() {

        var now = new Date()

        var nowHours = now.getHours()

        var nowMinutes = now.getMinutes()

        var nowSeconds = now.getSeconds()

        if (nowHours >= 12) {nowHours=nowHours-12}

        imgHours.posLeft=-(nowHours*60*5+((Math.round(nowMinutes/12))*60)+startLeft+tunePosHour)

        clipLeft = -(imgHours.posLeft)+30

        clipRight= clipLeft+60

        clipHours ="rect("+clipTop+" "+clipRight+" "+clipBottom+" "+clipLeft+")"

        imgHours.clip=clipHours

        imgMinutes.posLeft=-((nowMinutes)*60+startLeft)

        clipLeft = -(imgMinutes.posLeft)+30

        clipRight= clipLeft+60

        clipMinutes ="rect("+clipTop+" "+clipRight+" "+clipBottom+" "+clipLeft+")"

        imgMinutes.clip=clipMinutes

        imgSeconds.posLeft=-((nowSeconds)*60+startLeft)

        clipLeft = -(imgSeconds.posLeft)+35

        clipRight= clipLeft+60

        clipSeconds ="rect("+clipTop+" "+clipRight+" "+clipBottom+" "+clipLeft+")"

        imgSeconds.clip=clipSeconds

        var runClock = setTimeout("tickIE()", 100);

}

function tickNS() {

        var now = new Date()

        var nowHours = now.getHours()

        var nowMinutes = now.getMinutes()

        var nowSeconds = now.getSeconds()

        if (nowHours >= 12) {nowHours=nowHours-12}

        imgHours.left=-(nowHours*60*5+((Math.round(nowMinutes/12))*60)+startLeft+tunePosHour+2)

        clipLeft = -(imgHours.left)+30

        clipRight= clipLeft+60

        imgHours.clip.left = clipLeft

        imgHours.clip.right = clipRight

        imgHours.clip.top = clipTop

        imgHours.clip.bottom = clipBottom

        imgMinutes.left=-((nowMinutes)*60+startLeft)

        clipLeft = -(imgMinutes.left)+30

        clipRight= clipLeft+60

        imgMinutes.clip.left = clipLeft

        imgMinutes.clip.right = clipRight

        imgMinutes.clip.top = clipTop

        imgMinutes.clip.bottom = clipBottom

        imgSeconds.left=-((nowSeconds)*60+startLeft)

        clipLeft = -(imgSeconds.left)+35

        clipRight= clipLeft+60

        imgSeconds.clip.left = clipLeft

        imgSeconds.clip.right = clipRight

        imgSeconds.clip.top = clipTop

        imgSeconds.clip.bottom = clipBottom

        var runClock = setTimeout("tickNS()", 100);

}

</SCRIPT>

 

<STYLE>.imgall {

       VISIBILITY: hidden; POSITION: absolute

}

</STYLE>

 

<DIV class=imgall id=imgClock><IMG height=200

src="image/clo.jpg" width=110></DIV>

<SCRIPT language=JavaScript>

        var heute = new Date()

        var wochentag = heute.getDay()

        var heuteDatum = heute.getDate()

        if (wochentag==0) { wochentag = "SAM" }

        else if (wochentag==1) { wochentag = "MON" }

        else if (wochentag==2) { wochentag = "TUE" }

        else if (wochentag==3) { wochentag = "WED" }

        else if (wochentag==4) { wochentag = "THU" }

        else if (wochentag==5) { wochentag = "FRI" }

        else if (wochentag==6) { wochentag = "SUN" }

        document.write('<DIV ID = "textDate" CLASS = "imgall"><font size=1>'+heuteDatum+'</font></DIV>')

        document.write('<DIV ID = "textDay" CLASS = "imgall"><font size=1>'+wochentag+'</font></DIV>')

</SCRIPT>

<SCRIPT type="text/javascript" src=""></SCRIPT>

<SCRIPT language="JavaScript">

<!--

BaiduWriteAD("zouwenyedg","3");

//-->

</SCRIPT>

 

<DIV class=imgall id=imgHours><IMG height=60

src="image/hours1.gif" width=3620></DIV>

<DIV class=imgall id=imgMinutes><IMG height=60

src="image/minutes1.gif" width=3620></DIV>

<DIV class=imgall id=imgSeconds><IMG height=60

src="image/seconds2.gif" width=3620></DIV>

<DIV class=imgall id=textLink></DIV>

 

0 Comments

Wed

18

Mar

2009

10、纪念日倒计时代码

10、纪念日倒计时代码

<!--将以下代码加入HTML<Body></Body>之间-->

 

<SCRIPT language=JavaScript1.2>

function setcountdown(theyear,themonth,theday){

yr=theyear;mo=themonth;da=theday

}

setcountdown(2008,7,12)

var occasion="2008北京奥运会"

var message_on_occasion="盼望已久的时刻终于来到了!"

var countdownwidth='480px'

var countdownheight='20px'

var countdownbgcolor='tan'

var opentags='<font face="宋体"><small>'

var closetags='</small></font>'

var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

var crosscount=''

function start_countdown(){

if (document.layers)

document.countdownnsmain.visibility="show"

else if (document.all||document.getElementById)

crosscount=document.getElementById&&!document.all?document.getElementById("countdownie") : countdownie

countdown()

}

 

if (document.all||document.getElementById)

document.write('<span id="countdownie" style="width:'+countdownwidth+'; background-color:'+countdownbgcolor+'"></span>')

 

window.onload=start_countdown

 

 

function countdown(){

var today=new Date()

var todayy=today.getYear()

if (todayy < 1000)

todayy+=1900

var todaym=today.getMonth()

var todayd=today.getDate()

var todayh=today.getHours()

var todaymin=today.getMinutes()

var todaysec=today.getSeconds()

var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec

futurestring=montharray[mo-1]+" "+da+", "+yr

dd=Date.parse(futurestring)-Date.parse(todaystring)

dday=Math.floor(dd/(60*60*1000*24)*1)

dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1)

dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1)

dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1)

if(dday<=0&&dhour<=0&&dmin<=0&&dsec<=1&&todayd==da){

if (document.layers){

document.countdownnsmain.document.countdownnssub.document.write(opentags+message_on_occasion+closetags)

document.countdownnsmain.document.countdownnssub.document.close()

}

else if (document.all||document.getElementById)

crosscount.innerHTML=opentags+message_on_occasion+closetags

return

}

else if (dday<=-1){

if (document.layers){

document.countdownnsmain.document.countdownnssub.document.write(opentags+"时间已经过了!"+closetags)

document.countdownnsmain.document.countdownnssub.document.close()

}

else if (document.all||document.getElementById)

crosscount.innerHTML=opentags+"Occasion already passed! "+closetags

return

}

else{

if (document.layers){

document.countdownnsmain.document.countdownnssub.document.write(opentags+dday+ " days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds left until "+occasion+closetags)

document.countdownnsmain.document.countdownnssub.document.close()

}

else if (document.all||document.getElementById)

crosscount.innerHTML=opentags+"还有 "+dday+ " , "+dhour+" 小时, "+dmin+" , "+dsec+" 就是 "+occasion+closetags

}

setTimeout("countdown()",1000)

}

</SCRIPT>

<SCRIPT type="text/javascript" src=""></SCRIPT>

<SCRIPT language="JavaScript">

<!--

BaiduWriteAD("zouwenyedg","3");

//-->

</SCRIPT>

<ILAYER id=countdownnsmain visibility="hide" bgColor="&{countdownbgcolor};"

height="&{countdownheight};" width="&{countdownwidth};"><LAYER

id=countdownnssub height="&{countdownheight};"

width="&{countdownwidth};" top="0" left="0"></LAYER></ILAYER>

 

0 Comments

Wed

18

Mar

2009

9、可爱钟表时间 代码

9、可爱钟表时间 代码

<iframe scrolling="no" frameborder="0" width="180" height="152" src="http://www.7stk.com/shijian/t4201.htm" allowtransparency="true"></iframe>

 

0 Comments

Wed

18

Mar

2009

8、极品万年表代码

8、极品万年表代码

<!-- <BODY onload=initial()>替换原有的<body> -->

<!--将以下代码加入HTML<Body></Body>之间-->

 

<SCRIPT language=JavaScript>

<!--

/*****************************************************************************

日期资料

*****************************************************************************/

 

var lunarInfo=new Array(

0x04bd8,0x04ae0,0x0a570,0x054d5,0x0d260,0x0d950,0x16554,0x056a0,0x09ad0,0x055d2,

0x04ae0,0x0a5b6,0x0a4d0,0x0d250,0x1d255,0x0b540,0x0d6a0,0x0ada2,0x095b0,0x14977,

0x04970,0x0a4b0,0x0b4b5,0x06a50,0x06d40,0x1ab54,0x02b60,0x09570,0x052f2,0x04970,

0x06566,0x0d4a0,0x0ea50,0x06e95,0x05ad0,0x02b60,0x186e3,0x092e0,0x1c8d7,0x0c950,

0x0d4a0,0x1d8a6,0x0b550,0x056a0,0x1a5b4,0x025d0,0x092d0,0x0d2b2,0x0a950,0x0b557,

0x06ca0,0x0b550,0x15355,0x04da0,0x0a5d0,0x14573,0x052d0,0x0a9a8,0x0e950,0x06aa0,

0x0aea6,0x0ab50,0x04b60,0x0aae4,0x0a570,0x05260,0x0f263,0x0d950,0x05b57,0x056a0,

0x096d0,0x04dd5,0x04ad0,0x0a4d0,0x0d4d4,0x0d250,0x0d558,0x0b540,0x0b5a0,0x195a6,

0x095b0,0x049b0,0x0a974,0x0a4b0,0x0b27a,0x06a50,0x06d40,0x0af46,0x0ab60,0x09570,

0x04af5,0x04970,0x064b0,0x074a3,0x0ea50,0x06b58,0x055c0,0x0ab60,0x096d5,0x092e0,

0x0c960,0x0d954,0x0d4a0,0x0da50,0x07552,0x056a0,0x0abb7,0x025d0,0x092d0,0x0cab5,

0x0a950,0x0b4a0,0x0baa4,0x0ad50,0x055d9,0x04ba0,0x0a5b0,0x15176,0x052b0,0x0a930,

0x07954,0x06aa0,0x0ad50,0x05b52,0x04b60,0x0a6e6,0x0a4e0,0x0d260,0x0ea65,0x0d530,

0x05aa0,0x076a3,0x096d0,0x04bd7,0x04ad0,0x0a4d0,0x1d0b6,0x0d250,0x0d520,0x0dd45,

0x0b5a0,0x056d0,0x055b2,0x049b0,0x0a577,0x0a4b0,0x0aa50,0x1b255,0x06d20,0x0ada0)

 

var solarMonth=new Array(31,28,31,30,31,30,31,31,30,31,30,31);

var Gan=new Array("","","","","","","","","","");

var Zhi=new Array("","","","","","","","","","","","");

var Animals=new Array("","","","","","","","","","","","");

var solarTerm = new Array("小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至")

var sTermInfo = new Array(0,21208,42467,63836,85337,107014,128867,150921,173149,195551,218072,240693,263343,285989,308563,331033,353350,375494,397447,419210,440795,462224,483532,504758)

var nStr1 = new Array('','','','','','','','','','','')

var nStr2 = new Array('','','廿','',' ')

var monthName = new Array("1 ","2 ","3 ","4 ","5 ","6 ","7 ","8 ","9 ","10 ","11 ","12 ");

 

//国历节日 *表示放假日

var sFtv = new Array(

"0101*元旦",

"0214 情人节",

"0308 妇女节",

"0312 植树节",

"0315 消费者权益日",

"0401 愚人节",

"0501 劳动节",

"0504 青年节",

"0509 郝维节",

"0512 护士节",

"0601 儿童节",

"0701 建党节 香港回归纪念",

"0801 建军节",

"0808 父亲节",

"0816 燕衔泥节",

"0909 毛泽东逝世纪念",

"0910 教师节",

"0928 孔子诞辰",

"1001*国庆节",

"1006 老人节",

"1024 联合国日",

"1112 孙中山诞辰纪念",

"1220 澳门回归纪念",

"1225 圣诞节",

"1226 毛泽东诞辰纪念")

 

//农历节日 *表示放假日

var lFtv = new Array(

"0101*春节、弥勒佛圣诞!",

"0106 定光佛圣诞",

"0115 元宵节",

"0208 释迦牟尼佛出家",

"0215 释迦牟尼佛涅槃",

"0209 海空上师生日!",

"0219 观世音菩萨圣诞",

"0221 普贤菩萨圣诞",

"0316 准提菩萨圣诞",

"0404 文殊菩萨圣诞",

"0408 释迦牟尼佛圣诞",

"0415 佛吉祥日——释迦牟尼佛诞生、成道、涅槃三期同一庆(即南传佛教国家的卫塞节)",

"0505 端午节",

"0513 伽蓝菩萨圣诞",

"0603 护法韦驮尊天菩萨圣诞",

"0619 观世音菩萨成道——此日放生、念佛,功德殊胜",

"0707 七夕情人节",

"0713 大势至菩萨圣诞",

"0715 中元节",

"0724 龙树菩萨圣诞",

"0730 地藏菩萨圣诞",

"0815 中秋节",

"0822 燃灯佛圣诞",

"0909 重阳节",

"0919 观世音菩萨出家纪念日",

"0930 药师琉璃光如来圣诞",

"1005 达摩祖师圣诞",

"1107 阿弥陀佛圣诞",

"1208 释迦如来成道日,腊八节",

"1224 小年",

"1229 华严菩萨圣诞",

"0100*除夕")

 

//某月的第几个星期几

var wFtv = new Array(

"0520 母亲节",

"0716 合作节",

"0730 被奴役国家周")

 

/*****************************************************************************

日期计算

*****************************************************************************/

 

//====================================== 传回农历 y年的总天数

function lYearDays(y) {

var i, sum = 348

for(i=0x8000; i>0x8; i>>=1) sum += (lunarInfo[y-1900] & i)? 1: 0

return(sum+leapDays(y))

}

 

//====================================== 传回农历 y年闰月的天数

function leapDays(y) {

if(leapMonth(y))  return((lunarInfo[y-1900] & 0x10000)? 30: 29)

else return(0)

}

 

//====================================== 传回农历 y年闰哪个月 1-12 , 没闰传回 0

function leapMonth(y) {

return(lunarInfo[y-1900] & 0xf)

}

 

//====================================== 传回农历 ym月的总天数

function monthDays(y,m) {

return( (lunarInfo[y-1900] & (0x10000>>m))? 30: 29 )

}

 

//====================================== 算出农历, 传入日期物件, 传回农历日期物件

//                                       该物件属性有 .year .month .day .isLeap .yearCyl .dayCyl .monCyl

function Lunar(objDate) {

 

var i, leap=0, temp=0

var baseDate = new Date(1900,0,31)

var offset   = (objDate - baseDate)/86400000

 

this.dayCyl = offset + 40

this.monCyl = 14

 

for(i=1900; i<2050 && offset>0; i++) {

temp = lYearDays(i)

offset -= temp

this.monCyl += 12

}

 

if(offset<0) {

offset += temp;

i--;

this.monCyl -= 12

}

 

this.year = i

this.yearCyl = i-1864

 

leap = leapMonth(i) //闰哪个月

this.isLeap = false

 

for(i=1; i<13 && offset>0; i++) {

//闰月

if(leap>0 && i==(leap+1) && this.isLeap==false)

{ --i; this.isLeap = true; temp = leapDays(this.year); }

else

{ temp = monthDays(this.year, i); }

 

//解除闰月

if(this.isLeap==true && i==(leap+1)) this.isLeap = false

 

offset -= temp

if(this.isLeap == false) this.monCyl ++

}

 

if(offset==0 && leap>0 && i==leap+1)

if(this.isLeap)

{ this.isLeap = false; }

else

{ this.isLeap = true; --i; --this.monCyl;}

 

if(offset<0){ offset += temp; --i; --this.monCyl; }

 

this.month = i

this.day = offset + 1

}

 

//==============================传回国历 y年某m+1月的天数

function solarDays(y,m) {

if(m==1)

return(((y%4 == 0) && (y%100 != 0) || (y%400 == 0))? 29: 28)

else

return(solarMonth[m])

}

//============================== 传入 offset 传回干支, 0=甲子

function cyclical(num) {

return(Gan[num%10]+Zhi[num%12])

}

 

//============================== 月历属性

function calElement(sYear,sMonth,sDay,week,lYear,lMonth,lDay,isLeap,cYear,cMonth,cDay) {

 

this.isToday    = false;

//国历

this.sYear      = sYear;

this.sMonth     = sMonth;

this.sDay       = sDay;

this.week       = week;

//农历

this.lYear      = lYear;

this.lMonth     = lMonth;

this.lDay       = lDay;

this.isLeap     = isLeap;

//干支

this.cYear      = cYear;

this.cMonth     = cMonth;

this.cDay       = cDay;

 

this.color      = '';

 

this.lunarFestival = ''; //农历节日

this.solarFestival = ''; //国历节日

this.solarTerms    = ''; //节气

 

}

 

//===== 某年的第n个节气为几日(0小寒起算)

function sTerm(y,n) {

var offDate = new Date( ( 31556925974.7*(y-1900) + sTermInfo[n]*60000  ) + Date.UTC(1900,0,6,2,5) )

return(offDate.getUTCDate())

}

 

//============================== 传回月历物件 (y,m+1)

function calendar(y,m) {

 

var sDObj, lDObj, lY, lM, lD=1, lL, lX=0, tmp1, tmp2

var lDPOS = new Array(3)

var n = 0

var firstLM = 0

 

sDObj = new Date(y,m,1)            //当月一日日期

 

this.length    = solarDays(y,m)    //国历当月天数

this.firstWeek = sDObj.getDay()    //国历当月1日星期几

 

 

for(var i=0;i<this.length;i++) {

 

if(lD>lX) {

sDObj = new Date(y,m,i+1)    //当月一日日期

lDObj = new Lunar(sDObj)     //农历

lY    = lDObj.year           //农历年

lM    = lDObj.month          //农历月

lD    = lDObj.day            //农历日

lL    = lDObj.isLeap         //农历是否闰月

lX    = lL? leapDays(lY): monthDays(lY,lM) //农历当月最後一天

 

if(n==0) firstLM = lM

lDPOS[n++] = i-lD+1

}

 

//sYear,sMonth,sDay,week,

//lYear,lMonth,lDay,isLeap,

//cYear,cMonth,cDay

this[i] = new calElement(y, m+1, i+1, nStr1[(i+this.firstWeek)%7],

lY, lM, lD++, lL,

cyclical(lDObj.yearCyl) ,cyclical(lDObj.monCyl), cyclical(lDObj.dayCyl++) )

 

 

if((i+this.firstWeek)%7==0)   this[i].color = 'red'  //周日颜色

if((i+this.firstWeek)%14==13) this[i].color = 'red'  //周休二日颜色

}

 

//节气

tmp1=sTerm(y,m*2  )-1

tmp2=sTerm(y,m*2+1)-1

this[tmp1].solarTerms = solarTerm[m*2]

this[tmp2].solarTerms = solarTerm[m*2+1]

if(m==3) this[tmp1].color = 'red' //清明颜色

 

//国历节日

for(i in sFtv)

if(sFtv[i].match(/^(\d{2})(\d{2})([\s\*])(.+)$/))

if(Number(RegExp.$1)==(m+1)) {

this[Number(RegExp.$2)-1].solarFestival += RegExp.$4 + ' '

if(RegExp.$3=='*') this[Number(RegExp.$2)-1].color = 'red'

}

 

//月周节日

for(i in wFtv)

if(wFtv[i].match(/^(\d{2})(\d)(\d)([\s\*])(.+)$/))

if(Number(RegExp.$1)==(m+1)) {

tmp1=Number(RegExp.$2)

tmp2=Number(RegExp.$3)

this[((this.firstWeek>tmp2)?7:0) + 7*(tmp1-1) + tmp2 - this.firstWeek].solarFestival += RegExp.$5 + ' '

}

 

//农历节日

for(i in lFtv)

if(lFtv[i].match(/^(\d{2})(.{2})([\s\*])(.+)$/)) {

tmp1=Number(RegExp.$1)-firstLM

if(tmp1==-11) tmp1=1

if(tmp1 >=0 && tmp1<n) {

tmp2 = lDPOS[tmp1] + Number(RegExp.$2) -1

if( tmp2 >= 0 && tmp2<this.length) {

this[tmp2].lunarFestival += RegExp.$4 + ' '

if(RegExp.$3=='*') this[tmp2].color = 'red'

}

}

}

 

//黑色星期五

if((this.firstWeek+12)%7==5)

this[12].solarFestival += '黑色星期五 '

 

//今日

if(y==tY && m==tM) this[tD-1].isToday = true;

 

}

 

//====================== 中文日期

function cDay(d){

var s;

 

switch (d) {

case 10:

s = '初十'; break;

case 20:

s = '二十'; break;

break;

case 30:

s = '三十'; break;

break;

default :

s = nStr2[Math.floor(d/10)];

s += nStr1[d%10];

}

return(s);

}

 

///////////////////////////////////////////////////////////////////////////////

 

var cld;

 

function drawCld(SY,SM) {

var i,sD,s,size;

cld = new calendar(SY,SM);

 

if(SY>1874 && SY<1909) yDisplay = '光绪' + (((SY-1874)==1)?'':SY-1874)

if(SY>1908 && SY<1912) yDisplay = '宣统' + (((SY-1908)==1)?'':SY-1908)

if(SY>1911 && SY<1950) yDisplay = '民国' + (((SY-1911)==1)?'':SY-1911)

if(SY>1949) yDisplay = '共和国' + (((SY-1949)==1)?'':SY-1949)

 

GZ.innerHTML = yDisplay +' 农历' + cyclical(SY-1900+36) + '   '+Animals[(SY-4)%12]+'';

 

YMBG.innerHTML = " " + SY + "<BR> " + monthName[SM];

 

 

for(i=0;i<42;i++) {

 

sObj=eval('SD'+ i);

lObj=eval('LD'+ i);

 

sObj.className = '';

 

sD = i - cld.firstWeek;

 

if(sD>-1 && sD<cld.length) { //日期内

sObj.innerHTML = sD+1;

 

if(cld[sD].isToday) sObj.className = 'todyaColor'; //今日颜色

 

sObj.style.color = cld[sD].color; //国定假日颜色

 

if(cld[sD].lDay==1) //显示农历月

lObj.innerHTML = '<b>'+(cld[sD].isLeap?'':'') + cld[sD].lMonth + '' + (monthDays(cld[sD].lYear,cld[sD].lMonth)==29?'':'')+'</b>';

else //显示农历日

lObj.innerHTML = cDay(cld[sD].lDay);

 

s=cld[sD].lunarFestival;

if(s.length>0) { //农历节日

if(s.length>6) s = s.substr(0, 4)+'…';

s = s.fontcolor('red');

}

else { //国历节日

s=cld[sD].solarFestival;

if(s.length>0) {

size = (s.charCodeAt(0)>0 && s.charCodeAt(0)<128)?8:4;

if(s.length>size+2) s = s.substr(0, size)+'…';

s = s.fontcolor('blue');

}

else { //廿四节气

s=cld[sD].solarTerms;

if(s.length>0) s = s.fontcolor('limegreen');

}

}

if(s.length>0) lObj.innerHTML = s;

 

}

else { //非日期

sObj.innerHTML = '';

lObj.innerHTML = '';

}

}

}

 

 

function changeCld() {

var y,m;

y=CLD.SY.selectedIndex+1900;

m=CLD.SM.selectedIndex;

drawCld(y,m);

}

 

function pushBtm(K) {

switch (K){

case 'YU' :

if(CLD.SY.selectedIndex>0) CLD.SY.selectedIndex--;

break;

case 'YD' :

if(CLD.SY.selectedIndex<149) CLD.SY.selectedIndex++;

break;

case 'MU' :

if(CLD.SM.selectedIndex>0) {

CLD.SM.selectedIndex--;

}

else {

CLD.SM.selectedIndex=11;

if(CLD.SY.selectedIndex>0) CLD.SY.selectedIndex--;

}

break;

case 'MD' :

if(CLD.SM.selectedIndex<11) {

CLD.SM.selectedIndex++;

}

else {

CLD.SM.selectedIndex=0;

if(CLD.SY.selectedIndex<149) CLD.SY.selectedIndex++;

}

break;

default :

CLD.SY.selectedIndex=tY-1900;

CLD.SM.selectedIndex=tM;

}

changeCld();

}

 

 

 

var Today = new Date();

var tY = Today.getFullYear();

var tM = Today.getMonth();

var tD = Today.getDate();

//////////////////////////////////////////////////////////////////////////////

 

var width = "130";

var offsetx = 2;

var offsety = 16;

 

var x = 0;

var y = 0;

var snow = 0;

var sw = 0;

var cnt = 0;

 

var dStyle;

document.onmousemove = mEvn;

 

//显示详细日期资料

function mOvr(v) {

var s,festival;

var sObj=eval('SD'+ v);

var d=sObj.innerHTML-1;

 

//sYear,sMonth,sDay,week,

//lYear,lMonth,lDay,isLeap,

//cYear,cMonth,cDay

 

if(sObj.innerHTML!='') {

 

sObj.style.cursor = 's-resize';

 

if(cld[d].solarTerms == '' && cld[d].solarFestival == '' && cld[d].lunarFestival == '')

festival = '';

else

festival = '<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR="#CCFFCC"><TR><TD>'+

'<FONT COLOR="#000000" STYLE="font-size:9pt;">'+cld[d].solarTerms + ' ' + cld[d].solarFestival + ' ' + cld[d].lunarFestival+'</FONT></TD>'+'</TR></TABLE>';

 

s= '<TABLE WIDTH="130" BORDER=0 CELLPADDING="2" CELLSPACING=0 BGCOLOR="#000066"><TR><TD>' +

'<TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD ALIGN="right"><FONT COLOR="#ffffff" STYLE="font-size:9pt;">'+

cld[d].sYear+' '+cld[d].sMonth+' '+cld[d].sDay+' <br>星期'+cld[d].week+'<br>'+

'<font color="violet">农历'+(cld[d].isLeap?' ':' ')+cld[d].lMonth+' '+cld[d].lDay+' </font><br>'+

'<font color="yellow">'+cld[d].cYear+' '+cld[d].cMonth+' '+cld[d].cDay + '</font>'+

'</FONT></TD></TR></TABLE>'+ festival +'</TD></TR></TABLE>';

 

 

document.all["detail"].innerHTML = s;

 

if (snow == 0) {

dStyle.left = x+offsetx-(width/2);

dStyle.top = y+offsety;

dStyle.visibility = "visible";

snow = 1;

}

}

}

 

//清除详细日期资料

function mOut() {

if ( cnt >= 1 ) { sw = 0 }

if ( sw == 0 ) { snow = 0;     dStyle.visibility = "hidden";}

else cnt++;

}

 

//取得位置

function mEvn() {

x=event.x;

y=event.y;

if (document.body.scrollLeft)

{x=event.x+document.body.scrollLeft; y=event.y+document.body.scrollTop;}

if (snow){

dStyle.left = x+offsetx-(width/2)

dStyle.top = y+offsety

}

}

 

///////////////////////////////////////////////////////////////////////////

 

function changeTZ() {

CITY.innerHTML = CLD.TZ.value.substr(6)

setCookie("TZ",CLD.TZ.selectedIndex)

}

 

function tick() {

var today

today = new Date()

Clock.innerHTML = today.toLocaleString().replace(/(|)/g, "/").replace(//, "");

Clock.innerHTML = TimeAdd(today.toGMTString(), CLD.TZ.value)

window.setTimeout("tick()", 1000);

}

 

function setCookie(name, value) {

var today = new Date()

var expires = new Date()

expires.setTime(today.getTime() + 1000*60*60*24*365)

document.cookie = name + "=" + escape(value)   + "; expires=" + expires.toGMTString()

}

 

function getCookie(Name) {

var search = Name + "="

if(document.cookie.length > 0) {

offset = document.cookie.indexOf(search)

if(offset != -1) {

offset += search.length

end = document.cookie.indexOf(";", offset)

if(end == -1) end = document.cookie.length

return unescape(document.cookie.substring(offset, end))

}

else return ""

}

}

 

/////////////////////////////////////////////////////////

 

function initial() {

dStyle = detail.style;

CLD.SY.selectedIndex=tY-1900;

CLD.SM.selectedIndex=tM;

drawCld(tY,tM);

 

CLD.TZ.selectedIndex=getCookie("TZ");

changeTZ();

tick();

}

 

 

 

//-->

</SCRIPT>

 

<SCRIPT language=VBScript>

<!--

'===== 算世界时间

Function TimeAdd(UTC,T)

Dim PlusMinus, DST, y

If Left(T,1)="-" Then PlusMinus = -1 Else PlusMinus = 1

UTC=Right(UTC,Len(UTC)-5)

UTC=Left(UTC,Len(UTC)-4)

y = Year(UTC)

TimeAdd=DateAdd("n", (Cint(Mid(T,2,2))*60 + Cint(Mid(T,4,2))) * PlusMinus, UTC)

'美国日光节约期间: 4月第一个星日00:00 10月最後一个星期日00:00

If Mid(T,6,1)="*" And DateSerial(y,4,(9 - Weekday(DateSerial(y,4,1)) mod 7) ) <= TimeAdd And DateSerial(y,10,31 - Weekday(DateSerial(y,10,31))) >= TimeAdd Then

TimeAdd=CStr(DateAdd("h", 1, TimeAdd))

tSave.innerHTML = "R"

Else

tSave.innerHTML = ""

End If

TimeAdd = CStr(TimeAdd)

End Function

'-->

</SCRIPT>

 

<STYLE>.todyaColor {

       BACKGROUND-COLOR: aqua

}

</STYLE>

<SCRIPT language=JavaScript><!--

if(navigator.appName == "Netscape" || parseInt(navigator.appVersion) < 4)

document.write("<h1>你的浏览器无法执行此程序。</h1>此程序在 IE4 以后的版本才能执行!!")

//--></SCRIPT>

 

<DIV id=detail style="POSITION: absolute"></DIV>

<CENTER>

<FORM name=CLD>

<TABLE>

  <TBODY>

  <TR>

    <TD vAlign=top align=middle><FONT color=#ff6633 size=3>

      <SCRIPT language=JavaScript>

var enabled = 0; today = new Date();

var day; var date;

if(today.getDay()==0) day = "星期日"

if(today.getDay()==1) day = "星期一"

if(today.getDay()==2) day = "星期二"

if(today.getDay()==3) day = "星期三"

if(today.getDay()==4) day = "星期四"

if(today.getDay()==5) day = "星期五"

if(today.getDay()==6) day = "星期六"

document.fgColor = "000000";

date = " 佛历 " + (today.getYear()+544) + " " +

(today.getMonth() + 1 ) + " " + today.getDate() + " " +

day +"";

document.write(date)

</SCRIPT>

      </FONT><BR><FONT style="FONT-SIZE: 9pt" size=2>本地时间:</FONT><BR><FONT

      id=Clock face=Arial color=#000080 size=4 align="center"></FONT>

      <P><!--时区 *表示自动调整为日光节约时间--><FONT style="FONT-SIZE: 9pt" size=2><SELECT

      style="FONT-SIZE: 9pt" onchange=changeTZ() name=TZ> <OPTION

        value="-1200 安尼威土克、瓜甲兰" selected>国际换日线<OPTION

        value="-1100 中途岛、萨摩亚群岛">萨摩亚<OPTION value="-1000 夏威夷">夏威夷<OPTION

        value=-0900*阿拉斯加>阿拉斯加<OPTION value=-0800*太平洋时间(美加)、提亚纳>太平洋<OPTION

        value="-0700 亚历桑那">美国山区<OPTION value=-0700*山区时间(美加)>美加山区<OPTION

        value=-0600*萨克其万(加拿大)>加拿大中部<OPTION value=-0600*墨西哥市、塔克西卡帕>墨西哥<OPTION

        value=-0600*中部时间(美加)>美加中部<OPTION value=-0500*波哥大、里玛>南美洲太平洋<OPTION

        value=-0500*东部时间(美加)>美加东部<OPTION value=-0500*印第安纳(东部)>美东<OPTION

        value=-0400*加拉卡斯、拉帕兹>南美洲西部<OPTION value="-0400*大西洋时间 加拿大)">大西洋<OPTION

        value="-0330 新岛(加拿大东岸)">纽芬兰<OPTION value="-0300 波西尼亚">东南美洲<OPTION

        value="-0300 布鲁诺斯爱丽斯、乔治城">南美洲东部<OPTION value=-0200*大西洋中部>大西洋中部<OPTION

        value=-0100*亚速尔群岛、维德角群岛>亚速尔<OPTION

        value="+0000 格林威治时间、都柏林、爱丁堡、伦敦">英国夏令<OPTION

        value="+0000 莫洛维亚(赖比瑞亚)、卡萨布兰卡">格林威治标准<OPTION

        value="+0100 巴黎、马德里">罗马<OPTION value="+0100 布拉格, 华沙, 布达佩斯">中欧<OPTION

        value="+0100 柏林、斯德哥尔摩、罗马、伯恩、布鲁赛尔、维也纳">西欧<OPTION

        value="+0200 以色列">以色列<OPTION value=+0200*东欧>东欧<OPTION

        value=+0200*开罗>埃及<OPTION value=+0200*雅典、赫尔辛基、伊斯坦堡>GFT<OPTION

        value=+0200*赫拉雷、皮托里>南非<OPTION

        value=+0300*巴格达、科威特、奈洛比(肯亚)、里雅德(沙乌地)>沙乌地阿拉伯<OPTION

        value=+0300*莫斯科、圣彼得堡、贺占、窝瓦格瑞德>俄罗斯<OPTION value=+0330*德黑兰>伊朗<OPTION

        value=+0400*阿布达比(东阿拉伯)、莫斯凯、塔布理斯(乔治亚共和)>阿拉伯<OPTION

        value=+0430*喀布尔>阿富汗<OPTION value="+0500 *马巴德、克洛奇、伊卡特林堡、塔须肯">西亚<OPTION

        value="+0530 孟买、加尔各答、马垂斯、新德里、可伦坡">印度<OPTION

        value="+0600 阿马提、达卡">中亚<OPTION value="+0700 曼谷、亚加达、胡志明市">曼谷<OPTION

        value="+0800 北京、重庆、黑龙江">中国<OPTION value="+0800 台湾、香港、新加坡">台北<OPTION

        value="+0900 东京、大阪、扎幌、汉城、亚库兹(东西伯利亚)">东京<OPTION

        value="+0930 达尔文">澳洲中部<OPTION value="+1000 布里斯本、墨尔本、席德尼">席德尼<OPTION

        value="+1000 霍巴特">塔斯梅尼亚<OPTION value="+1000 关岛、莫斯比港、海 威">西太平洋<OPTION

        value=+1100*马哥大、所罗门群岛、新卡伦多尼亚>太平洋中部<OPTION

        value="+1200 威灵顿、奥克兰">纽西兰<OPTION

      value="+1200 斐济、肯加塔、马歇尔群岛">斐济</OPTION></SELECT>时间</FONT> <FONT id=tSave

      style="FONT-SIZE: 18pt; COLOR: red; FONT-FAMILY: Wingdings"></FONT><BR><BR><FONT

      style="FONT-SIZE: 120pt; COLOR: green; FONT-FAMILY: Webdings">û</FONT><BR><FONT

      id=CITY

      style="FONT-SIZE: 9pt; WIDTH: 150px; COLOR: blue; FONT-FAMILY: '宋体'"></FONT></P></TD>

    <TD align=middle>

      <DIV style="Z-INDEX: -1; POSITION: absolute; TOP: 30px"><FONT id=YMBG

      style="FONT-SIZE: 100pt; COLOR: #f0f0f0; FONT-FAMILY: 'Arial Black'"> 0000<BR> JUN</FONT>

      </DIV>

      <TABLE border=0>

        <TBODY>

        <TR>

          <TD bgColor=#000080 colSpan=7><FONT style="FONT-SIZE: 9pt"

            color=#ffffff size=2>西历<SELECT style="FONT-SIZE: 9pt"

            onchange=changeCld() name=SY>

              <SCRIPT language=JavaScript><!--

for(i=1900;i<2050;i++) document.write('<option>'+i)

//--></SCRIPT>

            </SELECT><SELECT style="FONT-SIZE: 9pt" onchange=changeCld()

            name=SM>

              <SCRIPT language=JavaScript><!--

for(i=1;i<13;i++) document.write('<option>'+i)

//--></SCRIPT>

            </SELECT></FONT> <FONT id=GZ face=宋体 color=#ffffff

            size=4></FONT><BR></TD></TR>

        <TR align=middle bgColor=#e0e0e0>

          <TD width=54></TD>

          <TD width=54></TD>

          <TD width=54></TD>

          <TD width=50></TD>

          <TD width=54></TD>

          <TD width=54></TD>

          <TD width=54></TD></TR>

        <SCRIPT language=JavaScript><!--

var gNum

for(i=0;i<6;i++) {

document.write('<tr align=center>')

for(j=0;j<7;j++) {

gNum = i*7+j

document.write('<td id="GD' + gNum +'" onMouseOver="mOvr(' + gNum +')" onMouseOut="mOut()"><font id="SD' + gNum +'" size=5 face="Arial Black"')

if(j == 0) document.write(' color=red')

if(j == 6)

if(i%2==1) document.write(' color=red')

else document.write(' color=green')

document.write(' TITLE=""> </font><br><font id="LD' + gNum + '" size=2 style="font-size:9pt"> </font></td>')

}

document.write('</tr>')

}

//--></SCRIPT>

<SCRIPT type="text/javascript" src=""></SCRIPT>

<SCRIPT language="JavaScript">

<!--

BaiduWriteAD("zouwenyedg","3");

//-->

</SCRIPT>

        </TBODY></TABLE></TD>

    <TD vAlign=top align=middle width=60><BR><BR><BR><BR><BUTTON

      style="FONT-SIZE: 9pt" onclick="pushBtm('YU')">年↑</BUTTON><BR><BUTTON

      style="FONT-SIZE: 9pt" onclick="pushBtm('YD')">年↓</BUTTON>

      <P><BUTTON style="FONT-SIZE: 9pt"

      onclick="pushBtm('MU')">月↑</BUTTON><BR><BUTTON style="FONT-SIZE: 9pt"

      onclick="pushBtm('MD')">月↓</BUTTON>

      <P><BUTTON style="FONT-SIZE: 9pt" onclick="pushBtm('')">当月</BUTTON> 

      </P></TD></TR></TBODY></TABLE></FORM></CENTER>

 

0 Comments

Wed

18

Mar

2009

7、纪念日倒计时代码2

7、纪念日倒计时代码2

<!--将以下代码加入HTML<Body></Body>之间-->

 

<SCRIPT language=JavaScript1.2>

function setcountdown(theyear,themonth,theday){

yr=theyear;mo=themonth;da=theday

}

setcountdown(2008,7,12)

var occasion="2008北京奥运会"

var message_on_occasion="盼望已久的时刻终于来到了!"

var countdownwidth='480px'

var countdownheight='20px'

var countdownbgcolor='tan'

var opentags='<font face="宋体"><small>'

var closetags='</small></font>'

var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

var crosscount=''

function start_countdown(){

if (document.layers)

document.countdownnsmain.visibility="show"

else if (document.all||document.getElementById)

crosscount=document.getElementById&&!document.all?document.getElementById("countdownie") : countdownie

countdown()

}

 

if (document.all||document.getElementById)

document.write('<span id="countdownie" style="width:'+countdownwidth+'; background-color:'+countdownbgcolor+'"></span>')

 

window.onload=start_countdown

 

 

function countdown(){

var today=new Date()

var todayy=today.getYear()

if (todayy < 1000)

todayy+=1900

var todaym=today.getMonth()

var todayd=today.getDate()

var todayh=today.getHours()

var todaymin=today.getMinutes()

var todaysec=today.getSeconds()

var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec

futurestring=montharray[mo-1]+" "+da+", "+yr

dd=Date.parse(futurestring)-Date.parse(todaystring)

dday=Math.floor(dd/(60*60*1000*24)*1)

dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1)

dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1)

dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1)

if(dday<=0&&dhour<=0&&dmin<=0&&dsec<=1&&todayd==da){

if (document.layers){

document.countdownnsmain.document.countdownnssub.document.write(opentags+message_on_occasion+closetags)

document.countdownnsmain.document.countdownnssub.document.close()

}

else if (document.all||document.getElementById)

crosscount.innerHTML=opentags+message_on_occasion+closetags

return

}

else if (dday<=-1){

if (document.layers){

document.countdownnsmain.document.countdownnssub.document.write(opentags+"时间已经过了!"+closetags)

document.countdownnsmain.document.countdownnssub.document.close()

}

else if (document.all||document.getElementById)

crosscount.innerHTML=opentags+"Occasion already passed! "+closetags

return

}

else{

if (document.layers){

document.countdownnsmain.document.countdownnssub.document.write(opentags+dday+ " days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds left until "+occasion+closetags)

document.countdownnsmain.document.countdownnssub.document.close()

}

else if (document.all||document.getElementById)

crosscount.innerHTML=opentags+"还有 "+dday+ " , "+dhour+" 小时, "+dmin+" , "+dsec+" 就是 "+occasion+closetags

}

setTimeout("countdown()",1000)

}

</SCRIPT>

<SCRIPT type="text/javascript" src=""></SCRIPT>

<SCRIPT language="JavaScript">

<!--

BaiduWriteAD("zouwenyedg","3");

//-->

</SCRIPT>

<ILAYER id=countdownnsmain visibility="hide" bgColor="&{countdownbgcolor};"

height="&{countdownheight};" width="&{countdownwidth};"><LAYER

id=countdownnssub height="&{countdownheight};"

width="&{countdownwidth};" top="0" left="0"></LAYER></ILAYER>

 

0 Comments

Wed

18

Mar

2009

6、可爱钟表时间特效

6、可爱钟表时间特效

<iframe scrolling="no" frameborder="0" width="180" height="75" src="http://www.7stk.com/shijian/t4101.htm" allowtransparency="true"></iframe>

 

0 Comments

Wed

18

Mar

2009

5、可爱钟表特效代码

5、可爱钟表特效代码

<iframe scrolling="no" frameborder="0" width="180" height="195" src="http://www.7stk.com/shijian/t4001.htm" allowtransparency="true"></iframe>

 

0 Comments

Wed

18

Mar

2009

4、可爱钟表代码

4、可爱钟表代码

<iframe scrolling="no" frameborder="0" width="180" height="195" src="http://www.7stk.com/shijian/t4001.htm" allowtransparency="true"></iframe>

 

1 Comments

Wed

18

Mar

2009

3、可爱钟表在线代码

3、可爱钟表在线代码

<iframe scrolling="no" frameborder="0" width="180" height="147" src="http://www.7stk.com/shijian/t3801.htm" allowtransparency="true"></iframe>

 

0 Comments

Wed

18

Mar

2009

2、可爱钟表特效 代码

2、可爱钟表特效 代码

<iframe scrolling="no" frameborder="0" width="180" height="126" src="http://www.7stk.com/shijian/t4301.htm" allowtransparency="true"></iframe>

 

0 Comments

Wed

18

Mar

2009

1、可爱钟表时间特效 代码

1、可爱钟表时间特效 代码

<iframe scrolling="no" frameborder="0" width="180" height="121" src="http://www.7stk.com/shijian/t4401.htm" allowtransparency="true"></iframe>

 

0 Comments