Wed

18

Mar

2009

90、英文的时间显示

90、英文的时间显示

脚本说明:

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

<script LANGUAGE="JavaScript">

<!-- Begin

function number(x) {

if (x==1) return "one"; if (x==2) return "two"; if (x==3) return "three";

if (x==4) return "four"; if (x==5) return "five"; if (x==6) return "six";

if (x==7) return "seven"; if (x==8) return "eight"; if (x==9) return "nine";

if (x==10) return "ten"; if (x==11) return "eleven"; if (x==12) return "twelve";

return x; //default

}

function ishtime(h,m) {

h = number(h)

if (m<=3 || m>57) return h+" o'clock";

if (m<=7)  return "five past "+h;

if (m<=12) return "ten past "+h;

if (m<=17) return "quarter past "+h;

if (m<=23) return "twenty past "+h;

if (m<=28) return "twenty-five past "+h;

if (m<=33) return "half past "+h;

if (m<=38) return "twenty-five to "+h;

if (m<=43) return "twenty to "+h;

if (m<=48) return "quarter to "+h;

if (m<=53) return "ten to "+h;

if (m<=58) return "five to "+h;

return "h:m"; // never reached?

}

function daytime(h) {

if (!h || h>21) return " at night"

if (h<12) return " in the morning";

if (h<=17) return " in the afternoon";

return " in the evening"; // default

}

function ish(h,m) {

if (!h && !m) { // if no time supplied, use the system time

time = new Date()

h = time.getHours()

m = time.getMinutes()

}

z = daytime(h);

h = h % 12 // fix to 12 hour clock

if (m>57 && time.getSeconds()>30) m++; // round seconds

if (m>60) m=0 // round up minutes

if (m>33) h++ // round up hours

if (h>12)  h = 1 // the clock turns round..

if (h==0) h = 12

return "It's now about "+ishtime(h,m)+z+"."

}

// End -->

</script>

<script language="JavaScript">

<!--HIDE FROM OLD BROWSERS--

document.writeln(ish().fontcolor("black"),"<P>")

<!--DONE-->

</script>

 

0 Comments

Wed

18

Mar

2009

89、时间相互对比

89、时间相互对比

重云傍苧:

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

<!--By:  Rakesh Jain (rakeshjain@iname.com) -->

<!-- Web Site:  http://www.bhabus.com -->

 

function displaydatetime() {

if (!document.layers && !document.all)      return;

  var today;

  var timeLocal;

  var timeUTC;

  today = new Date();

  timeLocal = today.toLocaleString() + " " + "Local"; //Convert to current locale.

  timeUTC = today.toUTCString(); //Convert to UTC.

  if (document.layers) {

    document.layers.clockLocal.document.write(timeLocal);

    document.layers.clockLocal.document.close();

    document.layers.clockUTC.document.write(timeUTC);

    document.layers.clockUTC.document.close();}

  else if (document.all) {

  clockLocal.innerHTML = timeLocal;

  clockUTC.innerHTML = timeUTC;}

  setTimeout("displaydatetime()", 500)

}

  window.onload = displaydatetime;

//  End -->

</script>

<span id=clockLocal style="position:relative;"></span><br>

<span id=clockUTC style="position:relative;"></span>

 

0 Comments

Wed

18

Mar

2009

88、准确的时间选择框

88、准确的时间选择框

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

//set todays date

Now = new Date();

NowDay = Now.getDate();

NowMonth = Now.getMonth();

NowYear = Now.getYear();

if (NowYear < 2000) NowYear += 1900; //for Netscape

 

//function for returning how many days there are in a month including leap years

function DaysInMonth(WhichMonth, WhichYear)

{

  var DaysInMonth = 31;

  if (WhichMonth == "Apr" || WhichMonth == "Jun" || WhichMonth == "Sep" || WhichMonth == "Nov") DaysInMonth = 30;

  if (WhichMonth == "Feb" && (WhichYear/4) != Math.floor(WhichYear/4))       DaysInMonth = 28;

  if (WhichMonth == "Feb" && (WhichYear/4) == Math.floor(WhichYear/4))      DaysInMonth = 29;

  return DaysInMonth;

}

 

//function to change the available days in a months

function ChangeOptionDays(Which)

{

  DaysObject = eval("document.Form1." + Which + "Day");

  MonthObject = eval("document.Form1." + Which + "Month");

  YearObject = eval("document.Form1." + Which + "Year");

 

  Month = MonthObject[MonthObject.selectedIndex].text;

  Year = YearObject[YearObject.selectedIndex].text;

 

  DaysForThisSelection = DaysInMonth(Month, Year);

  CurrentDaysInSelection = DaysObject.length;

  if (CurrentDaysInSelection > DaysForThisSelection)

  {

    for (i=0; i<(CurrentDaysInSelection-DaysForThisSelection); i++)

    {

      DaysObject.options[DaysObject.options.length - 1] = null

    }

  }

  if (DaysForThisSelection > CurrentDaysInSelection)

  {

    for (i=0; i<(DaysForThisSelection-CurrentDaysInSelection); i++)

    {

      NewOption = new Option(DaysObject.options.length + 1);

      DaysObject.add(NewOption);

    }

  }

    if (DaysObject.selectedIndex < 0) DaysObject.selectedIndex == 0;

}

 

//function to set options to today

function SetToToday(Which)

{

  DaysObject = eval("document.Form1." + Which + "Day");

  MonthObject = eval("document.Form1." + Which + "Month");

  YearObject = eval("document.Form1." + Which + "Year");

 

  YearObject[0].selected = true;

  MonthObject[NowMonth].selected = true;

 

  ChangeOptionDays(Which);

 

  DaysObject[NowDay-1].selected = true;

}

 

//function to write option years plus x

function WriteYearOptions(YearsAhead)

{

  line = "";

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

  {

    line += "<OPTION>";

    line += NowYear + i;

  }

  return line;

}

//  End -->

</script>

<FORM name="Form1">

<SELECT name="FirstSelectDay">

       <OPTION>1

       <OPTION>2

       <OPTION>3

       <OPTION>4

       <OPTION>5

       <OPTION>6

       <OPTION>7

       <OPTION>8

       <OPTION>9

       <OPTION>10

       <OPTION>11

       <OPTION>12

       <OPTION>13

       <OPTION>14

       <OPTION>15

       <OPTION>16

       <OPTION>17

       <OPTION>18

       <OPTION>19

       <OPTION>20

       <OPTION>21

       <OPTION>22

       <OPTION>23

       <OPTION>24

       <OPTION>25

       <OPTION>26

       <OPTION>27

       <OPTION>28

       <OPTION>29

       <OPTION>30

       <OPTION>31

</SELECT>

<SELECT name="FirstSelectMonth" onchange="ChangeOptionDays('FirstSelect')">

       <OPTION>Jan

       <OPTION>Feb

       <OPTION>Mar

       <OPTION>Apr

       <OPTION>May

       <OPTION>Jun

       <OPTION>Jul

       <OPTION>Aug

       <OPTION>Sep

       <OPTION>Oct

       <OPTION>Nov

       <OPTION>Dec

</SELECT>

<SELECT name="FirstSelectYear" onchange="ChangeOptionDays('FirstSelect')">

       <SCRIPT language="JavaScript">

              document.write(WriteYearOptions(50));

       </SCRIPT>

</SELECT>

</FORM>

 

 

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

<body bgcolor="#fef4d9" onLoad="SetToToday('FirstSelect');">

 

0 Comments

Wed

18

Mar

2009

87、英文的特殊时间显示

87、英文的特殊时间显示

重云傍苧:

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

dayName = new Array("", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")

monName = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")

now = new Date

//  End -->

</script>

<SCRIPT LANGUAGE="JavaScript">

 

<!-- This script and many more are available free online at -->

<!-- The JavaScript Source!! http://javascript.internet.com -->

 

<!-- Begin

var strDay;

if ((now.getDate() == 1) || (now.getDate() != 11) && (now.getDate() % 10 == 1))         // Correction for 11th and 1st/21st/31st

       strDay = "st ";

else if ((now.getDate() == 2) || (now.getDate() != 12) && (now.getDate() % 10 == 2)) // Correction for 12th and 2nd/22nd/32nd

       strDay = "nd ";

else if ((now.getDate() == 3) || (now.getDate() != 13) && (now.getDate() % 10 == 3)) // Correction for 13th and 3rd/23rd/33rd

       strDay = "rd ";

else

       strDay = "th ";

document.write(

dayName[now.getDay()]

+

" the "

+

now.getDate()

+

strDay

+

"of "

+

monName[now.getMonth()]

+

", "

+

now.getFullYear()

)

//  End -->

</script>

 

0 Comments

Wed

18

Mar

2009

86、二十四小时时钟

86、二十四小时时钟

脚本说明:

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

<script language="JavaScript">

<!--

 

 

f1Col='ccccc0';//face colour.

f2Col='ccccc0';//face colour.

d1Col='ff0000';//dot colour.

d2Col='ff0000';//dot colour.

 

hCol='00ff00';//hours colour.

mCol='00ff00';//minutes colour.

sCol='00ff00';//seconds colour.

ClockHeight=50;

ClockWidth=50;

 

//Alter nothing below! Alignments will be lost!

 

h=10;

m=7;

s=7;

 

face24='06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 01 02 03 04 05';

face24=face24.split(' ');

n1=face24.length;

face12='15 20 25 30 35 40 45 50 55 0 5 10';

face12=face12.split(' ');

n2=face12.length;

p="<font face=Arial size=1 color=#"+f1Col+">";

p2="<font face=Arial size=1 color=#"+f2Col+">";

 

 

 

 

e=360/n1;

e2=360/n2

e3=360/60

 

HandHeight=ClockHeight/6;

HandWidth=ClockWidth/6;

y=0;

x=0;

 

ns6=(document.getElementById&&!document.all);

ns=(document.layers);

ie=(document.all);

 

if (ns){

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

document.write('<layer name="nshour24'+i+'" top=0 left=0 height=15 width=15><center>'+p+face24[i]+'</font></center></layer>');

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

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

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

document.write('<layer name="nshour12'+i+'" top=0 left=0 height=15 width=15><center>'+p2+face12[i]+'</font></center></layer>');

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

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

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

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

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

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

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

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

}

if (ie||document.getElementById){

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

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

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

document.write('<div id="dots1'+i+'" style="position:absolute;top:0px;left:0px;width:2px;height:2px;font-size:2px;background:#'+d1Col+'"></div>');

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

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

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

document.write('<div id="dots2'+i+'" style="position:absolute;top:0px;left:0px;height:2px;width:2px;font-size:2px;background:#'+d2Col+'"></div>');

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

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

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

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

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

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

}

 

 

function Scroll(){

if (ns){

y=window.pageYOffset+window.innerHeight-ClockHeight*2;

x=window.pageXOffset+window.innerWidth-ClockWidth*2.3;

}

if (ns6){

y=window.pageYOffset+window.innerHeight-ClockHeight*2.1;

x=window.pageXOffset+window.innerWidth-ClockWidth*2.2;

}

if (ie){

y=document.body.scrollTop+window.document.body.clientHeight-ClockHeight*2;

x=document.body.scrollLeft+window.document.body.clientWidth-ClockWidth*2;

}

setTimeout('Scroll()',50);

}

Scroll();

 

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.57 + Math.PI * hr/12 + Math.PI*parseInt(time.getMinutes())/720;

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

 var cs=(ns)?document.layers['nsS'+i]:(ie)?document.all['ieS'+i].style:document.getElementById("ieS"+i).style;

 cs.top=y+(i*HandHeight)*Math.sin(sec);

 cs.left=x+(i*HandWidth)*Math.cos(sec);

}

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

 var cm=(ns)?document.layers['nsM'+i]:(ie)?document.all['ieM'+i].style:document.getElementById("ieM"+i).style;

 cm.top=y+(i*HandHeight)*Math.sin(min);

 cm.left=x+(i*HandWidth)*Math.cos(min);

}

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

 var ch=(ns)?document.layers['nsH'+i]:(ie)?document.all['ieH'+i].style:document.getElementById("ieH"+i).style;

 ch.top=y+(i*HandHeight)*Math.sin(hrs);

 ch.left=x+(i*HandWidth)*Math.cos(hrs);

}

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

 var d2=(ns)?document.layers['nsdots2'+i]:(ie)?document.all['dots2'+i].style:document.getElementById("dots2"+i).style;

 d2.top=y + ClockHeight*Math.sin(-1.0471 + i*e2*Math.PI/180);

 d2.left=x + ClockWidth*Math.cos(-1.0471 + i*e2*Math.PI/180);

}

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

 var h12=(ns)?document.layers['nshour12'+i]:(ie)?document.all['hour12'+i].style:document.getElementById("hour12"+i).style;

 h12.top=y-6 + ClockHeight*1.2*Math.sin(i*e2*Math.PI/180);

 h12.left=x-6 + ClockWidth*1.2*Math.cos(i*e2*Math.PI/180);

}

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

 var d1=(ns)?document.layers['nsdots1'+i]:(ie)?document.all['dots1'+i].style:document.getElementById("dots1"+i).style;

 d1.top=y + ClockHeight*1.5*Math.sin(-1.0471 + i*e*Math.PI/180);

 d1.left=x + ClockWidth*1.5*Math.cos(-1.0471 + i*e*Math.PI/180);

}

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

 var h24=(ns)?document.layers['nshour24'+i]:(ie)?document.all['hour24'+i].style:document.getElementById("hour24"+i).style;

 h24.top=y-6 + ClockHeight*1.7*Math.sin(i*e*Math.PI/180);

 h24.left=x-6 + ClockWidth*1.7*Math.cos(i*e*Math.PI/180);

}

setTimeout('ClockAndAssign()',500);

}

ClockAndAssign();

 

 

//-->

</script>

固定的长针为时针,短针为分针,转动的当然是秒针了

 

0 Comments

Wed

18

Mar

2009

85、跟随鼠标时钟

85、跟随鼠标时钟

脚本说明:

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

<script language="JavaScript">

<!--

dCol='ffffff';//date colour.

fCol='ffffff';//face colour.

sCol='00ff00';//seconds colour.

mCol='0000ff';//minutes colour.

hCol='ff0000';//hours colour.

ClockHeight=40;

ClockWidth=40;

ClockFromMouseY=0;

ClockFromMouseX=100;

 

//Alter nothing below! Alignments will be lost!

 

d=new Array("SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY");

m=new Array("JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER");

date=new Date();

day=date.getDate();

year=date.getYear();

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

TodaysDate=" "+d[date.getDay()]+" "+day+" "+m[date.getMonth()]+" "+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+"><B>";

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

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]+'</B></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]+'</B></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()',20);

}

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

//-->

</script>

0 Comments

Wed

18

Mar

2009

84、跟随鼠标时钟

84、跟随鼠标时钟

脚本说明:

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

<script language="JavaScript">

<!--

fcol='aecae5';//face colour.

sCol='ff0000';//seconds colour.

mCol='aecae5';//minutes colour.

hCol='aecae5';//hours colour.

ClockHeight=40;

ClockWidth=40;

ClockFromMouseY=80;

ClockFromMouseX=0;

 

//Alter nothing below! Alignments will be lost!

 

H='...';

H=H.split('');

M='....';

M=M.split('');

S='.....';

S=S.split('');

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

font='Arial';

size=1;

speed=0.5;

ns=(document.layers);

ie=(document.all);

msg=msg.split(' ');

n=msg.length;

a=size*10;

ymouse=0;

xmouse=0;

scrll=0;

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

Split=360/n;

HandHeight=ClockHeight/4.5

HandWidth=ClockWidth/4.5

HandY=-7;

HandX=-2.5;

scrll=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;

}

if (ns){

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

document.write('<layer name="nsFace'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+props+msg[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="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+msg[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){

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);

 }

}

function Delay(){

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

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

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

for (var 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()',20);

}

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

//-->

</script>

0 Comments

Wed

18

Mar

2009

83、固定的挂钟

83、固定的挂钟

脚本说明:

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

<SCRIPT language=javascript>

var dot=65

rads=new Array(65)

function rad () {

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

       if (document.all) rads[i]=new Array (eval('rad'+i).style,-100,-100)

       else rads[i] = new Array (eval('document.rad'+i),-100,-100)

       }

}

 

function setCircle() {

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

              rads[i][0].left=rads[i][1]+pX-15

              if (document.layers) rads[i][0].left+=10

              rads[i][0].top=rads[i][2]+pY-20

              //if (document.layers) rads[i][0].top-=5

 

       }

}

 

 

function counter() {

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

              rad=Math.PI*(i/((dot-1)/2))

              rads[i][1] = Math.sin(rad)*60;

              rads[i][2] = -Math.cos(rad)*60;

              }

setCircle()

}

 

pX=400;pY=150

obs = new Array(13)

function ob () {

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

       if (document.all) obs[i]=new Array (eval('ob'+i).style,-100,-100)

       else obs[i] = new Array (eval('document.ob'+i),-100,-100)

       }

}

function cl(a,b,c){

       if (document.all) {

              if (a!=0) b+=-1

              eval('c'+a+'.style.pixelTop='+(pY+(c-5)))

              eval('c'+a+'.style.pixelLeft='+(pX+(b)))

              }

else{

       if (a!=0) b+=10

       eval('document.c'+a+'.top='+(pY+(c)))

       eval('document.c'+a+'.left='+(pX+(b)))

}

}

 

function runClock() {

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

              obs[i][0].left=obs[i][1]+pX

              obs[i][0].top=obs[i][2]+pY

       }

}

 

var lastsec

function timer() {

       time = new Date ()

       sec = time.getSeconds()

       if (sec!=lastsec) {

 

              lastsec = sec

              sec=Math.PI*sec/30

              min=Math.PI*time.getMinutes()/30

              hr =Math.PI*((time.getHours()*60)+time.getMinutes())/360

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

                     obs[i][1] = Math.sin(sec) * (44 - (i-1)*11)-16;

                     if (document.layers)obs[i][1]+=10;

                     obs[i][2] = -Math.cos(sec) * (44 - (i-1)*11)-27;

              }

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

                     obs[i][1] = Math.sin(min) * (40 - (i-6)*10)-16;

                     if (document.layers)obs[i][1]+=10;

                     obs[i][2] = -Math.cos(min) * (40 - (i-6)*10)-27;

              }

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

                     obs[i][1] = Math.sin(hr) * (37 - (i-10)*11)-16;

                     if (document.layers)obs[i][1]+=10;

                     obs[i][2] = -Math.cos(hr) * (37 - (i-10)*11)-27;

              }

       }

 

}

function setNum(){

cl (0,-67,-65);

cl (1,10,-51);

cl (2,28,-33);

cl (3,35,-8);

cl (4,28,17);

cl (5,10,35);

cl (6,-15,42);

cl (7,-40,35);

cl (8,-58,17);

cl (9,-65,-8);

cl (10,-58,-33);

cl (11,-40,-51);

cl (12,-16,-56);

 

}

</SCRIPT>

 

<DIV id=c0

style="HEIGHT: 128px; LEFT: 38px; POSITION: absolute; TOP: -119px; WIDTH: 686px; Z-INDEX: 2"></DIV>

<DIV id=c1

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>1</B>

</DIV>

<DIV id=c2

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>2</B>

</DIV>

<DIV id=c3

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>3</B>

</DIV>

<DIV id=c4

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>4</B>

</DIV>

<DIV id=c5

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>5</B>

</DIV>

<DIV id=c6

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>6</B>

</DIV>

<DIV id=c7

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>7</B>

</DIV>

<DIV id=c8

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>8</B>

</DIV>

<DIV id=c9

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>9</B>

</DIV>

<DIV id=c10

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>10</B>

</DIV>

<DIV id=c11

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>11</B>

</DIV>

<DIV id=c12

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>12</B>

</DIV>

<DIV id=ob0 style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 1">

</DIV>

<DIV id=ob1

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#0000ff size=+3><B>.</B></FONT> </DIV>

<DIV id=ob2

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#0000ff size=+3><B>.</B></FONT> </DIV>

<DIV id=ob3

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#0000ff size=+3><B>.</B></FONT> </DIV>

<DIV id=ob4

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#0000ff size=+3><B>.</B></FONT> </DIV>

<DIV id=ob5

style="HEIGHT: 32px; LEFT: -35px; POSITION: absolute; TOP: -4px; WIDTH: 742px; Z-INDEX: 8"><FONT

color=#0000ff size=+3><B>.</B></FONT> </DIV>

<DIV id=ob6

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#00ffff size=+3><B>.</B></FONT> </DIV>

<DIV id=ob7

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#00ffff size=+3><B>.</B></FONT> </DIV>

<DIV id=ob8

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#00ffff size=+3><B>.</B></FONT> </DIV>

<DIV id=ob9

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#00ffff size=+3><B>.</B></FONT> </DIV>

<DIV id=ob10

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 6"><FONT

color=#ff0000 size=+3><B>.</B></FONT> </DIV>

<DIV id=ob11

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 6"><FONT

color=#ff0000 size=+3><B>.</B></FONT> </DIV>

<DIV id=ob12

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 6"><FONT

color=#ff0000 size=+3><B>.</B></FONT> </DIV>

<DIV id=rad0 style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 1">

</DIV>

<DIV id=rad1

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad2

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad3

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad4

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad5

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad6

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad7

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad8

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad9

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad10

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad11

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad12

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad13

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad14

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad15

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad16

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad17

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad18

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad19

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad20

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad21

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad22

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad23

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad24

 

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad25

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad26

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad27

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad28

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad29

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad30

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad31

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad32

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad33

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad34

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad35

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad36

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad37

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad38

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad39

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad40

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad41

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad42

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad43

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad44

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad45

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad46

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad47

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad48

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad49

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad50

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad51

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad52

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad53

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad54

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad55

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad56

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad57

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad58

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad59

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad60

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad61

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad62

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad63

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad64

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

 

 

 

 

 

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

<body onload="rad();counter();ob();setNum();setInterval('timer()',100);setInterval('runClock()',100)">

 

0 Comments

Wed

18

Mar

2009

83、固定的挂钟

83、固定的挂钟

脚本说明:

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

<SCRIPT language=javascript>

var dot=65

rads=new Array(65)

function rad () {

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

       if (document.all) rads[i]=new Array (eval('rad'+i).style,-100,-100)

       else rads[i] = new Array (eval('document.rad'+i),-100,-100)

       }

}

 

function setCircle() {

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

              rads[i][0].left=rads[i][1]+pX-15

              if (document.layers) rads[i][0].left+=10

              rads[i][0].top=rads[i][2]+pY-20

              //if (document.layers) rads[i][0].top-=5

 

       }

}

 

 

function counter() {

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

              rad=Math.PI*(i/((dot-1)/2))

              rads[i][1] = Math.sin(rad)*60;

              rads[i][2] = -Math.cos(rad)*60;

              }

setCircle()

}

 

pX=400;pY=150

obs = new Array(13)

function ob () {

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

       if (document.all) obs[i]=new Array (eval('ob'+i).style,-100,-100)

       else obs[i] = new Array (eval('document.ob'+i),-100,-100)

       }

}

function cl(a,b,c){

       if (document.all) {

              if (a!=0) b+=-1

              eval('c'+a+'.style.pixelTop='+(pY+(c-5)))

              eval('c'+a+'.style.pixelLeft='+(pX+(b)))

              }

else{

       if (a!=0) b+=10

       eval('document.c'+a+'.top='+(pY+(c)))

       eval('document.c'+a+'.left='+(pX+(b)))

}

}

 

function runClock() {

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

              obs[i][0].left=obs[i][1]+pX

              obs[i][0].top=obs[i][2]+pY

       }

}

 

var lastsec

function timer() {

       time = new Date ()

       sec = time.getSeconds()

       if (sec!=lastsec) {

 

              lastsec = sec

              sec=Math.PI*sec/30

              min=Math.PI*time.getMinutes()/30

              hr =Math.PI*((time.getHours()*60)+time.getMinutes())/360

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

                     obs[i][1] = Math.sin(sec) * (44 - (i-1)*11)-16;

                     if (document.layers)obs[i][1]+=10;

                     obs[i][2] = -Math.cos(sec) * (44 - (i-1)*11)-27;

              }

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

                     obs[i][1] = Math.sin(min) * (40 - (i-6)*10)-16;

                     if (document.layers)obs[i][1]+=10;

                     obs[i][2] = -Math.cos(min) * (40 - (i-6)*10)-27;

              }

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

                     obs[i][1] = Math.sin(hr) * (37 - (i-10)*11)-16;

                     if (document.layers)obs[i][1]+=10;

                     obs[i][2] = -Math.cos(hr) * (37 - (i-10)*11)-27;

              }

       }

 

}

function setNum(){

cl (0,-67,-65);

cl (1,10,-51);

cl (2,28,-33);

cl (3,35,-8);

cl (4,28,17);

cl (5,10,35);

cl (6,-15,42);

cl (7,-40,35);

cl (8,-58,17);

cl (9,-65,-8);

cl (10,-58,-33);

cl (11,-40,-51);

cl (12,-16,-56);

 

}

</SCRIPT>

 

<DIV id=c0

style="HEIGHT: 128px; LEFT: 38px; POSITION: absolute; TOP: -119px; WIDTH: 686px; Z-INDEX: 2"></DIV>

<DIV id=c1

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>1</B>

</DIV>

<DIV id=c2

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>2</B>

</DIV>

<DIV id=c3

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>3</B>

</DIV>

<DIV id=c4

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>4</B>

</DIV>

<DIV id=c5

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>5</B>

</DIV>

<DIV id=c6

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>6</B>

</DIV>

<DIV id=c7

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>7</B>

</DIV>

<DIV id=c8

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>8</B>

</DIV>

<DIV id=c9

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>9</B>

</DIV>

<DIV id=c10

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>10</B>

</DIV>

<DIV id=c11

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>11</B>

</DIV>

<DIV id=c12

style="FONT-SIZE: 11px; LEFT: 20px; POSITION: absolute; TOP: -20px; Z-INDEX: 5"><B>12</B>

</DIV>

<DIV id=ob0 style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 1">

</DIV>

<DIV id=ob1

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#0000ff size=+3><B>.</B></FONT> </DIV>

<DIV id=ob2

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#0000ff size=+3><B>.</B></FONT> </DIV>

<DIV id=ob3

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#0000ff size=+3><B>.</B></FONT> </DIV>

<DIV id=ob4

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#0000ff size=+3><B>.</B></FONT> </DIV>

<DIV id=ob5

style="HEIGHT: 32px; LEFT: -35px; POSITION: absolute; TOP: -4px; WIDTH: 742px; Z-INDEX: 8"><FONT

color=#0000ff size=+3><B>.</B></FONT> </DIV>

<DIV id=ob6

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#00ffff size=+3><B>.</B></FONT> </DIV>

<DIV id=ob7

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#00ffff size=+3><B>.</B></FONT> </DIV>

<DIV id=ob8

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#00ffff size=+3><B>.</B></FONT> </DIV>

<DIV id=ob9

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#00ffff size=+3><B>.</B></FONT> </DIV>

<DIV id=ob10

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 6"><FONT

color=#ff0000 size=+3><B>.</B></FONT> </DIV>

<DIV id=ob11

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 6"><FONT

color=#ff0000 size=+3><B>.</B></FONT> </DIV>

<DIV id=ob12

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 6"><FONT

color=#ff0000 size=+3><B>.</B></FONT> </DIV>

<DIV id=rad0 style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 1">

</DIV>

<DIV id=rad1

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad2

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad3

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad4

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad5

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad6

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad7

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad8

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad9

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad10

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad11

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad12

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad13

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad14

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad15

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad16

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad17

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad18

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad19

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad20

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad21

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad22

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad23

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad24

 

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad25

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad26

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad27

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad28

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad29

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad30

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad31

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad32

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad33

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad34

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad35

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad36

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad37

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad38

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad39

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad40

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad41

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad42

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad43

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad44

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad45

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad46

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad47

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad48

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad49

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad50

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad51

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad52

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad53

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad54

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad55

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad56

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad57

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad58

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad59

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad60

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad61

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 8"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad62

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad63

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

<DIV id=rad64

style="LEFT: -20px; POSITION: absolute; TOP: -20px; Z-INDEX: 7"><FONT

color=#000000><B>.</B></FONT> </DIV>

 

 

 

 

 

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

<body onload="rad();counter();ob();setNum();setInterval('timer()',100);setInterval('runClock()',100)">

 

0 Comments

Wed

18

Mar

2009

82、精彩的时间设定

82、精彩的时间设定

脚本说明:

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

<SCRIPT language=Javascript1.2>

<!--

 

var tags_before_clock = "<font face='geneva, arial, helvetica, sans-seif' size='4' color='#0000FF'>现在时间:"

var tags_middle_clock = "on"

var tags_after_clock  = "</font>"

 

if(navigator.appName == "Netscape") {

document.write('<layer id="clock"></layer><br>');

}

 

if (navigator.appVersion.indexOf("MSIE") != -1){

document.write('<span id="clock"></span>');

}

 

DaysofWeek = new Array()

  DaysofWeek[0]="Sunday"

  DaysofWeek[1]="Monday"

  DaysofWeek[2]="Tuesday"

  DaysofWeek[3]="Wednesday"

  DaysofWeek[4]="Thursday"

  DaysofWeek[5]="Friday"

  DaysofWeek[6]="Saturday"

 

Months = new Array()

  Months[0]="January"

  Months[1]="February"

  Months[2]="March"

  Months[3]="April"

  Months[4]="May"

  Months[5]="June"

  Months[6]="July"

  Months[7]="August"

  Months[8]="September"

  Months[9]="October"

  Months[10]="November"

  Months[11]="December"

 

function upclock(){

var dte = new Date();

var hrs = dte.getHours();

var min = dte.getMinutes();

var sec = dte.getSeconds();

var day = DaysofWeek[dte.getDay()]

var date = dte.getDate()

var month = Months[dte.getMonth()]

var year = dte.getFullYear()

 

var col = ":";

var spc = " ";

var com = ",";

var apm;

 

if (date == 1 || date == 21 || date == 31)

  {ender = "<sup>st</sup>"}

else

if (date == 2 || date == 22)

  {ender = "<sup>nd</sup>"}

else

if (date == 3 || date == 23)

  {ender = "<sup>rd</sup>"}

 

else

  {ender = "<sup>th</sup>"}

 

if (12 < hrs) {

apm="<font size='-1'>pm</font>";

hrs-=12;

}

 

else {

apm="<font size='-1'>am</font>";

}

 

if (hrs == 0) hrs=12;

if (hrs<=9) hrs="0"+hrs;

if (min<=9) min="0"+min;

if (sec<=9) sec="0"+sec;

 

if(navigator.appName == "Netscape") {

document.clock.document.write(tags_before_clock+hrs+col+min+col+sec+apm+spc+tags_middle_clock+spc+day+com+spc+date+ender+spc+month+com+spc+year+tags_after_clock);

document.clock.document.close();

}

 

if (navigator.appVersion.indexOf("MSIE") != -1){

clock.innerHTML = tags_before_clock+hrs+col+min+col+sec+apm+spc+tags_middle_clock+spc+day+com+spc+date+ender+spc+month+com+spc+year+tags_after_clock;

}

}

 

setInterval("upclock()",1000);

//-->

</SCRIPT>

 

0 Comments

Wed

18

Mar

2009

81、二十四小时时钟 代码

81、二十四小时时钟   代码

脚本说明:

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

<script language="JavaScript">

<!-- 24/12 Hour Clock by kurt.grigg@virgin.net

 

ClockFace=new Image();

ClockFace.src="image/glass.gif";

 

milCol='#ffffff';

civCol='#ffffff';

dotCol='#ddeefe';//dot colour.

hCol='#0000ff';//hours colour.

mCol='#0000ff';//minutes colour.

sCol='#ff0000';//seconds colour.

ampmCol='#ddeefe';

 

//Alter nothing below! Alignments will be lost!

ns=(document.layers);

ns6=(document.getElementById&&!document.all);

ie=(document.all);

h=3;

m=4;

s=5;

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

civ=civ.split(' ');

mil='13 14 15 16 17 18 19 20 21 22 23 24';

mil=mil.split(' ');

n=civ.length;

ClockHeight=30;

ClockWidth=30;

f24="<font face='Arial' size=1 color="+milCol+">";

f12="<font face='Arial' size=1 color="+civCol+">";

e=360/n;

HandHeight=ClockHeight/4;

HandWidth=ClockWidth/4;

y=0;

x=0;

if (!ns)

document.write('<div id="glass" style="position:absolute"><img src='+ClockFace.src+' height=142 width=142></div>');

else

document.write("<layer name='glass' top=0 left=0><img src='+ClockFace.src+' height=142 width=142></layer>");

if (!ns)

document.write("<div id='disp' style='position:absolute;width:50px;height:20px;text-align:center'> </div>");

else

document.write("<layer name=disp top=0 left=0></layer>");

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

if (!ns)

document.write('<div id="Mil'+i+'" style="position:absolute;width:15px;height:15px;text-align:center;color:#0000dd">'+f24+mil[i]+'</font></div>');

else

document.write('<layer name="Mil'+i+'" width=15 height=15><center>'+f24+mil[i]+'</font></center></layer>');

}

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

if (!ns)

document.write('<div id="Civ'+i+'" style="position:absolute;width:15px;height:15px;text-align:center;color:#0000dd">'+f12+civ[i]+'</font></div>');

else

document.write('<layer name="Civ'+i+'" width=15 height=15><center>'+f12+civ[i]+'</font></center></layer>');

}

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

if (!ns)

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

else

document.write('<layer name="D'+i+'" bgcolor='+dotCol+' width=2 height=2></layer>');

}

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

if (!ns)

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

else

document.write('<layer name="H'+i+'" bgcolor='+hCol+' width=2 height=2></layer>');

}

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

if (!ns)

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

else

document.write('<layer name="M'+i+'" bgcolor='+mCol+' width=2 height=2></layer>');

}

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

if (!ns)

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

else

document.write('<layer name="S'+i+'" bgcolor='+sCol+' width=2 height=2></layer>');

}

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;

ampm=(hr > 11)?"PM":"AM";

y=(ie)?document.body.scrollTop+window.document.body.clientHeight-ClockHeight*2.4:window.pageYOffset+window.innerHeight-ClockHeight*2.4;

x=(ie)?document.body.scrollLeft+window.document.body.clientWidth-ClockWidth*2.4:window.pageXOffset+window.innerWidth-ClockWidth*2.9;

Dspf=(ie)?glass.style:(ns6)?document.getElementById("glass").style:document.glass;

Dspf.top=y-71;

Dspf.left=x-70;

Dsp=(ie)?disp.style:(ns6)?document.getElementById("disp").style:document.disp;

Dsp.top=y-17;

Dsp.left=x-24;

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

CS=(ie)?document.all["S"+i].style:(ns6)?document.getElementById("S"+i).style:document.layers["S"+i];

CS.top=y+(i*HandHeight)*Math.sin(sec);

CS.left=x+(i*HandWidth)*Math.cos(sec);

}

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

CM=(ie)?document.all["M"+i].style:(ns6)?document.getElementById("M"+i).style:document.layers["M"+i];

CM.top=y+(i*HandHeight)*Math.sin(min);

CM.left=x+(i*HandWidth)*Math.cos(min);

}

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

CH=(ie)?document.all["H"+i].style:(ns6)?document.getElementById("H"+i).style:document.layers["H"+i];

CH.top=y+(i*HandHeight)*Math.sin(hrs);

CH.left=x+(i*HandWidth)*Math.cos(hrs);

}

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

CD=(ie)?document.all["D"+i].style:(ns6)?document.getElementById("D"+i).style:document.layers["D"+i];

CD.top=y+ ClockHeight*Math.sin(-1.0471 + i*e*Math.PI/180);

CD.left=x+ ClockWidth*Math.cos(-1.0471 + i*e*Math.PI/180);

}

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

CC=(ie)?document.all["Civ"+i].style:(ns6)?document.getElementById("Civ"+i).style:document.layers["Civ"+i];

CC.top=y-6 + ClockHeight*1.4*Math.sin(-1.0471 + i*e*Math.PI/180);

CC.left=x-6 + ClockWidth*1.4*Math.cos(-1.0471 + i*e*Math.PI/180);

}

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

CM=(ie)?document.all["Mil"+i].style:(ns6)?document.getElementById("Mil"+i).style:document.layers["Mil"+i];

CM.top=y-6 + ClockHeight*1.9*Math.sin(-1.0471 + i*e*Math.PI/180);

CM.left=x-6 + ClockWidth*1.9*Math.cos(-1.0471 + i*e*Math.PI/180);

}

setTimeout('ClockAndAssign()',100);

if (ie)disp.innerHTML='<font face=Arial size=6 color='+ampmCol+'>'+ampm+'</font>';

if (ns){

document.disp.document.open();

document.disp.document.write('<font face=Arial size=6 color='+ampmCol+'>'+ampm+'</font>');

document.disp.document.close();

}

}

function aorp(){

if (ns6)

document.getElementById("disp").innerHTML='<font face=Arial size=6 color='+ampmCol+'>'+ampm+'</font>';

setTimeout('aorp()',60000);

}

ClockAndAssign();

if (ns6)aorp();

//-->

</script>

 

<center>

        <SCRIPT LANGUAGE="JavaScript">

 

<!-- hide

 

function goHist(a)

 

{

 

   history.go(a);

 

}

 

//-->

 

</script></center>

 

0 Comments

Wed

18

Mar

2009

80、点击显示时间

80、点击显示时间

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

if (document.all){

  var wait = 4;    //how many seconds it shows the clock

  var message = "点击显示时间"    //the message

  var fgcolor = "yellow"    //border and text colors

  var bgcolor = "#ffa500"    //background color

/////////////DO NOT CHANGE PAST HERE////////////////

  width = message.length*20;

  var timer = null;

  function stop(){

    i = 0;

    clearTimeout(timer)

    document.all.display.innerHTML = message.bold();

  }

  function start(){

  i++

  var time = new Date()

  var hours = time.getHours()

  var minutes = time.getMinutes()

  var seconds = time.getSeconds()

  var clock = hours

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

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

  document.all.display.innerHTML = clock.bold();

  if (i <= wait)

    timer = setTimeout("start()",1000);

  else

    stop();

  }

}

//  End -->

</script>

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

if (document.all){

  document.write('<Div style="background-color:'+bgcolor+'; color:'+fgcolor+'; width:'+width+';border:2 double '+fgcolor+';cursor: hand;">');

  document.write('<center><Span id="display" onclick="start()"></Span></Center>');

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

}

//  End -->

</script>

 

 

 

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

<body onLoad="stop()">

 

 

0 Comments

Wed

18

Mar

2009

79、时钟显示在任意指定位置

79、时钟显示在任意指定位置

 

 

0 Comments

Wed

18

Mar

2009

78、很酷的图片时间倒计时

78、很酷的图片时间倒计时

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

//Created by DendE PhisH

function getTime() {

c1 = new Image(); c1.src = "1c.gif";

c2 = new Image(); c2.src = "2c.gif";

c3 = new Image(); c3.src = "3c.gif";

c4 = new Image(); c4.src = "4c.gif";

c5 = new Image(); c5.src = "5c.gif";

c6 = new Image(); c6.src = "6c.gif";

c7 = new Image(); c7.src = "7c.gif";

c8 = new Image(); c8.src = "8c.gif";

c9 = new Image(); c9.src = "9c.gif";

c0 = new Image(); c0.src = "0c.gif";

Cc = new Image(); Cc.src = "Cc.gif";

now = new Date();

 

//ENTER BELOW THE DATE YOU WISH TO COUNTDOWN TO

later = new Date("Jan 1 2002 0:00:01");

 

days = (later - now) / 1000 / 60 / 60 / 24;

daysRound = Math.floor(days);

hours = (later - now) / 1000 / 60 / 60 - (24 * daysRound);

hoursRound = Math.floor(hours);

minutes = (later - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);

minutesRound = Math.floor(minutes);

seconds = (later - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);

secondsRound = Math.round(seconds);

 

if (secondsRound <= 9) {

document.images.g.src = c0.src;

document.images.h.src = eval("c"+secondsRound+".src");

}

else {

document.images.g.src = eval("c"+Math.floor(secondsRound/10)+".src");

document.images.h.src = eval("c"+(secondsRound%10)+".src");

}

if (minutesRound <= 9) {

document.images.d.src = c0.src;

document.images.e.src = eval("c"+minutesRound+".src");

}

else {

document.images.d.src = eval("c"+Math.floor(minutesRound/10)+".src");

document.images.e.src = eval("c"+(minutesRound%10)+".src");

}

if (hoursRound <= 9) {

document.images.y.src = c0.src;

document.images.z.src = eval("c"+hoursRound+".src");

}

else {

document.images.y.src = eval("c"+Math.floor(hoursRound/10)+".src");

document.images.z.src = eval("c"+(hoursRound%10)+".src");

}

if (daysRound <= 9) {

document.images.x.src = c0.src;

document.images.a.src = c0.src;

document.images.b.src = eval("c"+daysRound+".src");

}

if (daysRound <= 99) {

document.images.x.src = c0.src;

document.images.a.src = eval("c"+Math.floor((daysRound/10)%10)+".src");

document.images.b.src = eval("c"+Math.floor(daysRound%10)+".src");

}

if (daysRound <= 999){

document.images.x.src = eval("c"+Math.floor(daysRound/100)+".src");

document.images.a.src = eval("c"+Math.floor((daysRound/10)%10)+".src");

document.images.b.src = eval("c"+Math.floor(daysRound%10)+".src");

}

newtime = window.setTimeout("getTime();", 1000);

}

//  End -->

</script>

<div align="center">

<h3>离开2002年还有:</h3>

</div>

 

<center>

<table><tr><td bgcolor="black" valign="bottom">

<img height=21 src="0c.gif" width=16 name=x>

<img height=21 src="0c.gif" width=16 name=a>

<img height=21 src="0c.gif" width=16 name=b>

<img height=21 src="Cc.gif" width=9 name=c>

<img height=21 src="0c.gif" width=16 name=y>

<img height=21 src="0c.gif" width=16 name=z>

<img height=21 src="Cc.gif" width=9 name=cz>

<img height=21 src="0c.gif" width=16 name=d>

<img height=21 src="0c.gif" width=16 name=e>

<img height=21 src="Cc.gif" width=9 name=f>

<img height=21 src="0c.gif" width=16 name=g>

<img height=21 src="0c.gif" width=16 name=h>

</td></tr></table>

</center>

 

<div align="center">

<h4>(Days : Hours : Minutes : Seconds)</h4>

</div>

 

第二步:把<body>里面的内容改为:

<BODY onLoad="getTime()">

 

0 Comments

Wed

18

Mar

2009

77、简单月历显示

77、简单月历显示

重云傍苧:

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

var week = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");

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

var today = new Date();

var month = today.getMonth();

var day = today.getDay();

var dayN = today.getDate();

var days = monthdays[month];

if (month == 1) {

  var year = today.getYear();

  if (year%4 == 0) days = 29;

}

document.write("<table border='0' cellspacing='0' cellpadding='0'>");

document.write("<tr>");

for (var i=0; i<7; i++) {

  document.write("<td width='30' height='30'>");

  document.write("<div align='center'>" + week[i] + "</div>");

  document.write("</td>");

}

document.write("</tr>");

var jumped = 0;

var inserted = 1;

var start = day - dayN%7 + 1;

if (start < 0) start += 7;

var weeks = parseInt((start + days)/7);

if ((start + days)%7 != 0) weeks++;

for (var i=weeks; i>0; i--) {

  document.write("<tr>");

  for (var j=7; j>0; j--) {

    document.write("<td>");

    if (jumped<start || inserted>days) {

      document.write("<div align='center'></div>");

      jumped++;

    }

    else {

      if (inserted == dayN) document.write("<div align='center'>[" + inserted + "]</div>");

      else document.write("<div align='center'>" + inserted + "</div>");

      inserted++;

    }

    document.write("</td>")

  }

  document.write("</tr>");

}

document.write("</table>");

//  End -->

</script>

 

0 Comments

Wed

18

Mar

2009

76、时间与日期的变换

76、时间与日期的变换

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

function printDate()

{

  var today = new Date();

  var day=today.getDate();

  var month = today.getMonth() + 1;

  var year = today.getFullYear().toString();

  var box=document.forms[0].DateBox;//this is where we want to print the date

  if ( ( month /10 ) < 1 )

  {

    month=("0" + month).toString(); //add the leading 0 -- looks more professional

  }

  if ( (day/10)<1)

  {

    day=("0" + today.getDate()).toString();//add the leading 0 -- looks better

  }

  box.value=month + "-" + day + "-" + year;

}

function printTime()

{

  var box = document.forms[0].DateBox; //this is where we want to print the date

  var thetime=new Date();

  if (thetime.getMinutes() / 10 <1 )

  {

    box.value=thetime.getHours() + ":" + "0" + thetime.getMinutes();

  }

  else

  {

    box.value=thetime.getHours() + ":" + thetime.getMinutes();

  }

}

//  End -->

</script>

<form name="stats">

<input type="text" readonly="readonly"  name="DateBox" size="10" onmouseover="printTime();" onmouseout="printDate();">

<br>

<font size="2">鼠标放上去变成时间显示</font>

</input>

</form>

 

 

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

<body  onLoad="return printDate()">

 

0 Comments

Wed

18

Mar

2009

75、按钮上的时间代码

75、按钮上的时间代码

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

 

<!-- Begin

// Set the dates below

var goLiveDate = "20011015";

var expireDate = "20101015";

 

var expireYear = expireDate.substring(0,4)

var expireMonth = expireDate.slice(4,-2)

var expireDay = expireDate.slice(6)

var liveYear = goLiveDate.substring(0,4)

var liveMonth = goLiveDate.slice(4,-2)

var liveDay = goLiveDate.slice(6)

var nowDate = new Date();

var day = nowDate.getUTCDate();

var month = nowDate.getUTCMonth();

var month1 = month + 1;

  if (month1 < 10)

  {

  month1 = "0" + month1;

  }

  if (day < 10)

  {

  day = "0" + day;

  }

var year = nowDate.getYear();

var GMTdate = year + "" + month1 + "" + day

if ((GMTdate < expireDate) && (GMTdate >= goLiveDate))

{

 

// Insert the text you want displayed below

document.write("<div align='center'><b>这些信息将在 " + liveMonth + "/" + liveDay + "/" + liveYear + "开始显示,<br> " + expireMonth + "/" + expireDay + "/" + expireYear +"会自动消失.</b></div>")

 

}

//  End -->

</script>

 

0 Comments

Wed

18

Mar

2009

74、自动显示版权日期

74、自动显示版权日期

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

<!--

    today=new Date();

    y0=today.getFullYear();

 

  // end hiding --->

</SCRIPT>

Copyright www.7stk.com 1997-<SCRIPT LANGUAGE="JavaScript">

  <!--- Hide from old browsers

    document.write(y0);

  // end hiding --->

</SCRIPT>

 

0 Comments

Wed

18

Mar

2009

73、台湾网友做的农历日历

73、台湾网友做的农历日历

脚本说明:

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

<script language="JavaScript">

<!--

function CalConv()

 {

       FIRSTYEAR = 1998;

       LASTYEAR = 2031;

 

       today = new Date();

       SolarYear = today.getFullYear();

       SolarMonth = today.getMonth() + 1;

       SolarDate = today.getDate();

       Weekday = today.getDay();

       LunarCal = [

  new tagLunarCal( 27,  5, 3, 43, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1 ),

  new tagLunarCal( 46,  0, 4, 48, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1 ), /* 88 */

  new tagLunarCal( 35,  0, 5, 53, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1 ), /* 89 */

  new tagLunarCal( 23,  4, 0, 59, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ),

  new tagLunarCal( 42,  0, 1,  4, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ),

  new tagLunarCal( 31,  0, 2,  9, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0 ),

  new tagLunarCal( 21,  2, 3, 14, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1 ), /* 93 */

  new tagLunarCal( 39,  0, 5, 20, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1 ),

  new tagLunarCal( 28,  7, 6, 25, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1 ),

  new tagLunarCal( 48,  0, 0, 30, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1 ),

  new tagLunarCal( 37,  0, 1, 35, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1 ), /* 97 */

  new tagLunarCal( 25,  5, 3, 41, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1 ),

  new tagLunarCal( 44,  0, 4, 46, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1 ),

  new tagLunarCal( 33,  0, 5, 51, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ),

  new tagLunarCal( 22,  4, 6, 56, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ), /* 101 */

  new tagLunarCal( 40,  0, 1,  2, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ),

  new tagLunarCal( 30,  9, 2,  7, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1 ),

  new tagLunarCal( 49,  0, 3, 12, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1 ),

  new tagLunarCal( 38,  0, 4, 17, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0 ), /* 105 */

  new tagLunarCal( 27,  6, 6, 23, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1 ),

  new tagLunarCal( 46,  0, 0, 28, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0 ),

  new tagLunarCal( 35,  0, 1, 33, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0 ),

  new tagLunarCal( 24,  4, 2, 38, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ), /* 109 */

  new tagLunarCal( 42,  0, 4, 44, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 ),

  new tagLunarCal( 31,  0, 5, 49, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0 ),

  new tagLunarCal( 21,  2, 6, 54, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1 ),

  new tagLunarCal( 40,  0, 0, 59, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1 ), /* 113 */

  new tagLunarCal( 28,  6, 2,  5, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0 ),

  new tagLunarCal( 47,  0, 3, 10, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1 ),

  new tagLunarCal( 36,  0, 4, 15, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1 ),

  new tagLunarCal( 25,  5, 5, 20, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0 ), /* 117 */

  new tagLunarCal( 43,  0, 0, 26, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1 ),

  new tagLunarCal( 32,  0, 1, 31, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0 ),

  new tagLunarCal( 22,  3, 2, 36, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0 ) ];

 /* 民國年每月之日數 */

 SolarCal = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];

 

 /* 民國年每月之累積日數, 平年與閏年 */

SolarDays = [  0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365, 396,  0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366, 397 ];

       AnimalIdx = ["", "", "", "", "", "", "", "", "", "", "", "" ];

       LocationIdx = [ "", "", "", "西" ];

       if ( SolarYear <= FIRSTYEAR || SolarYear > LASTYEAR ) return 1;

       sm = SolarMonth - 1;

              if ( sm < 0 || sm > 11 ) return 2;

              leap = GetLeap( SolarYear );

       if ( sm == 1 )

              d = leap + 28;

       else

              d = SolarCal[sm];

       if ( SolarDate < 1 || SolarDate > d ) return 3;

       y = SolarYear - FIRSTYEAR;

       acc = SolarDays[ leap*14 + sm ] + SolarDate;

       kc = acc + LunarCal[y].BaseKanChih;

       Kan = kc % 10;

       Chih = kc % 12;

       Location = LocationIdx[kc % 4];

       Age = kc % 60;

       if ( Age < 22 )

              Age = 22 - Age;

       else

              Age = 82 - Age;

       Animal = AnimalIdx[ Chih ];

       if ( acc <= LunarCal[y].BaseDays ) {

              y--;

              LunarYear = SolarYear - 1;

              leap = GetLeap( LunarYear );

              sm += 12;

              acc = SolarDays[leap*14 + sm] + SolarDate;

        }

       else

              LunarYear = SolarYear;

                     l1 = LunarCal[y].BaseDays;

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

              l2 = l1 + LunarCal[y].MonthDays[i] + 29;

              if ( acc <= l2 ) break;

              l1 = l2;

        }

       LunarMonth = i + 1;

       LunarDate = acc - l1;

       im = LunarCal[y].Intercalation;

       if ( im != 0 && LunarMonth > im ) {

              LunarMonth--;

              if ( LunarMonth == im ) LunarMonth = -im;

        }

       if ( LunarMonth > 12 ) LunarMonth -= 12;

 today=new Date();

        function initArray(){

                         this.length=initArray.arguments.length

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

                         this[i+1]=initArray.arguments[i]  }

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

             document.write("<span class=\"jsdhtml\"> ", today.getYear()," ",today.getMonth()+1," ",today.getDate()," ",d[today.getDay()+1],"");

         document.write( "<span class=\"jsdhtml\"><u> 农历 " + LunarMonth + "" + LunarDate + "</u>" );

       document.write( "" + Location + " " + Animal + Age + "</span>" );

                                  return 0;

}

 /* 求此民國年是否為閏年, 返回 0 為平年, 1 為閏年 */

function GetLeap( year )

 {

   if ( year % 400 == 0 )

     return 1;

   else if ( year % 100 == 0 )

     return 0;

   else if ( year % 4 == 0 )

     return 1;

   else

     return 0;

 }

function tagLunarCal( d, i, w, k, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13) {

 this.BaseDays = d;         /* 到民國 1 1 日到農曆正月初一的累積日數 */

 this.Intercalation = i;    /* 閏月月份. 0==此年沒有閏月 */

 this.BaseWeekday = w;      /* 此年民國 1 1 日為星期幾再減 1 */

 this.BaseKanChih = k;      /* 此年民國 1 1 日之干支序號減 1 */

 this.MonthDays = [ m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13 ]; /* 此農曆年每月之大小, 0==小月(29), 1==大月(30) */

}

//-->

 

CalConv();

 

</script>

 

0 Comments

Wed

18

Mar

2009

72、标题栏时间显示

72、标题栏时间显示

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

function settitle() {

var a = "这是时钟秒数是1040的时候显示的 ";

var b = "这是时钟秒数是2050的时候显示的";

var c = "这是时钟秒数是3060的时候显示的";

 var t = new Date();

 s = t.getSeconds();

 if (s == 10) {

  document.title = a;}

 else if (s == 20) {

 document.title = b;}

 else if (s == 30) {

 document.title = c;}

 else if (s == 40) {

 document.title = a;}

 else if (s == 50) {

 document.title = b;}

 else if (s == 00) {

 document.title = c;}

 setTimeout("settitle()", 1000);

 }

 settitle()

//  End -->

</script>

 

0 Comments

Wed

18

Mar

2009

71、鼠标在日历中的多用途

71、鼠标在日历中的多用途

脚本说明:

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

<script>

function Year_Month(){

var now = new Date();

var yy = now.getYear();

var mm = now.getMonth()+1;

var cl = '<font color="#0000df">';

if (now.getDay() == 0) cl = '<font color="#c00000">';

if (now.getDay() == 6) cl = '<font color="#00c000">';

return(cl + yy + '' + mm + '</font>');

}

function Date_of_Today(){

  var now = new Date();

  var cl = '<font color="#0000df">';

  if (now.getDay() == 0) cl = '<font color="#c00000">';

  if (now.getDay() == 6) cl = '<font color="#00c000">';

  return(cl + now.getDate() + '</font>');

  }

function Day_of_Today(){

  var day = new Array();

  day[0] = "星期日";

  day[1] = "星期一";

  day[2] = "星期二";

  day[3] = "星期三";

  day[4] = "星期四";

  day[5] = "星期五";

  day[6] = "星期六";

  var now = new Date();

  var cl = '<font color="#0000df">';

  if (now.getDay() == 0) cl = '<font color="#c00000">';

  if (now.getDay() == 6) cl = '<font color="#00c000">';

  return(cl + day[now.getDay()] + '</font>');

  }

function CurentTime(){

  var now = new Date();

  var hh = now.getHours();

  var mm = now.getMinutes();

  var ss = now.getTime() % 60000;

  ss = (ss - (ss % 1000)) / 1000;

  var clock = hh+':';

  if (mm < 10) clock += '0';

  clock += mm+':';

  if (ss < 10) clock += '0';

  clock += ss;

  return(clock);

  }

function refreshCalendarClock(){

  document.all.calendarClock1.innerHTML = Year_Month();

  document.all.calendarClock2.innerHTML = Date_of_Today();

  document.all.calendarClock3.innerHTML = Day_of_Today();

  document.all.calendarClock4.innerHTML = CurentTime();

  }

function getCalendarClockFreeCodeMsg(nn){

  if (nn == 'off') CalendarClockFreeCode.style.visibility = 'hidden';

  else {

  CalendarClockFreeCode.style.visibility = 'visible';

  setTimeout("getCalendarClockFreeCodeMsg('off')",10000);

  }

  }

var webUrl = webUrl;

function calendarClockFreeCode(){

  var win = window.open('about:blank','_blank','width=300,height=260,top=0,left=0');

  win.document.writeln('<'+'script language="JavaScript">');

  win.document.writeln('var autoClose = setTimeout("window.close()",30000)');

  win.document.writeln('</'+'script>');

  win.document.writeln('<p align="center"><a style="cursor:hand"');

  win.document.writeln(' onclick="clearTimeout(autoClose)">请点击此处,否则<br>30秒后此窗口将自动关闭</a></p>');

  win.document.writeln('<p>想在自己的网站上添加带日历时钟的朋友,请将下面框中的代码贴到网页的适当地方就可以了<br>');

  win.document.writeln('<textarea rows="4" cols="30">');

  win.document.writeln('<script>');

  win.document.writeln('function Year_Month(){ ');

  win.document.writeln('var now = new Date(); ');

  win.document.writeln('var yy = now.getYear(); ');

  win.document.writeln('var mm = now.getMonth()+1; ');

  win.document.writeln('var cl = \'<font color="#0000df">\'; ');

  win.document.writeln('if (now.getDay() == 0) cl = \'<font color="#c00000">\'; ');

  win.document.writeln('if (now.getDay() == 6) cl = \'<font color="#00c000">\'; ');

  win.document.writeln('return(cl + yy + \'\' + mm + \'<\/font>\'); ');

  win.document.writeln('}');

  win.document.writeln('function Date_of_Today(){ ');

  win.document.writeln(' var now = new Date(); ');

  win.document.writeln(' var cl = \'<font color="#0000df">\'; ');

  win.document.writeln(' if (now.getDay() == 0) cl = \'<font color="#c00000">\'; ');

  win.document.writeln(' if (now.getDay() == 6) cl = \'<font color="#00c000">\'; ');

  win.document.writeln(' return(cl + now.getDate() + \'<\/font>\'); ');

  win.document.writeln(' } ');

  win.document.writeln('function Day_of_Today(){ ');

  win.document.writeln(' var day = new Array(); ');

  win.document.writeln(' day[0] = "星期日"; ');

  win.document.writeln(' day[1] = "星期一"; ');

  win.document.writeln(' day[2] = "星期二"; ');

  win.document.writeln(' day[3] = "星期三"; ');

  win.document.writeln(' day[4] = "星期四"; ');

  win.document.writeln(' day[5] = "星期五"; ');

  win.document.writeln(' day[6] = "星期六"; ');

  win.document.writeln(' var now = new Date(); ');

  win.document.writeln(' var cl = \'<font color="#0000df">\'; ');

  win.document.writeln(' if (now.getDay() == 0) cl = \'<font color="#c00000">\'; ');

 

  win.document.writeln(' if (now.getDay() == 6) cl = \'<font color="#00c000">\'; ');

  win.document.writeln(' return(cl + day[now.getDay()] + \'<\/font>\'); ');

  win.document.writeln(' } ');

  win.document.writeln('function CurentTime(){ ');

  win.document.writeln(' var now = new Date(); ');

  win.document.writeln(' var hh = now.getHours(); ');

  win.document.writeln(' var mm = now.getMinutes(); ');

  win.document.writeln(' var ss = now.getTime() % 60000; ');

  win.document.writeln(' ss = (ss - (ss % 1000)) \/ 1000; ');

  win.document.writeln(' var clock = hh+\':\'; ');

  win.document.writeln(' if (mm < 10) clock += \'0\'; ');

  win.document.writeln(' clock += mm+\':\'; ');

  win.document.writeln(' if (ss < 10) clock += \'0\'; ');

  win.document.writeln(' clock += ss; ');

  win.document.writeln(' return(clock); ');

  win.document.writeln(' } ');

  win.document.writeln('function refreshCalendarClock(){ ');

  win.document.writeln(' document.all.calendarClock1.innerHTML = Year_Month(); ');

  win.document.writeln(' document.all.calendarClock2.innerHTML = Date_of_Today(); ');

  win.document.writeln(' document.all.calendarClock3.innerHTML = Day_of_Today(); ');

  win.document.writeln(' document.all.calendarClock4.innerHTML = CurentTime(); ');

  win.document.writeln(' } ');

  win.document.writeln('function getCalendarClockFreeCodeMsg(nn){ ');

  win.document.writeln(' if (nn == \'off\') CalendarClockFreeCode.style.visibility = \'hidden\'; ');

  win.document.writeln(' else { ');

  win.document.writeln(' CalendarClockFreeCode.style.visibility = \'visible\'; ');

  win.document.writeln(' setTimeout("getCalendarClockFreeCodeMsg(\'off\')",10000); ');

  win.document.writeln(' } ');

  win.document.writeln(' } ');

  win.document.writeln('var webUrl = webUrl; ');

  win.document.writeln('function calendarClockFreeCode(){ ');

  win.document.writeln(' var win = window.open(\'about:blank\',\'_blank\',\'width=300,height=260,top=0,left=0\'); ');

  win.document.writeln(' win.document.writeln(\'<\'+\'script language="JavaScript">\'); ');

  win.document.writeln(' win.document.writeln(\'var autoClose = setTimeout("window.close()",30000)\'); ');

  win.document.writeln(' win.document.writeln(\'<\/\'+\'script>\'); ');

  win.document.writeln(' win.document.writeln(\'<p align="center"><a style="cursor:hand"\');');

  win.document.writeln(' win.document.writeln(\' onclick="clearTimeout(autoClose)">请点击此处,否则<br>30秒后此窗口将自动关闭<\/a><\/p>\'); ');

  win.document.writeln(' win.document.writeln(\'<p>想在自己的网站上添加带日历时钟的朋友请将下面框中的代码贴到网页的适当地方就可以了<br>\'); ');

  win.document.writeln(' win.document.writeln(\'<textarea rows="4" cols="30">\');');

  win.document.writeln(' win.document.write (\'http:\/\/www.7stk.com\/\');');

  win.document.writeln(' win.document.writeln(\'<\/textarea><\/p>\'); ');

  win.document.writeln(' win.document.writeln(\'<p align="center"><a style="cursor:hand" onclick="window.close()">\'); ');

  win.document.writeln(' win.document.writeln(\'[关闭窗口]<\/a><\/p>\'); ');

  win.document.writeln(' } ');

  win.document.writeln('document.write(\'<table border="0" cellpadding="0" cellspacing="0"><tr><td>\'); ');

  win.document.writeln(' document.write(\'<table id="CalendarClockFreeCode" border="0" cellpadding="0" cellspacing="0" width="60" height="70" \');');

  win.document.writeln(' document.write(\'style="position:absolute;visibility:hidden" bgcolor="#eeeeee">\');');

  win.document.writeln(' document.write(\'<tr><td align="center"><font \');');

  win.document.writeln(' document.write(\'style="cursor:hand;color:#ff0000;font-family:宋体;font-size:9pt;line-height:110%" \');');

  win.document.writeln(' document.write(\'onclick=getCalendarClockFreeCodeMsg("off");calendarClockFreeCode()>获取<br>此特效代码<\/font>\'); ');

  win.document.writeln(' if (webUrl != \'netflower\'){ ');

  win.document.writeln(' document.write(\'<\/td><\/tr><tr><td align="center"><font \');');

  win.document.writeln(' document.write(\'style="cursor:hand;color:#2000ff;font-family:宋体;font-size:9pt;line-height:110%" \');');

  win.document.writeln(' document.write(\'onclick=getCalendarClockFreeCodeMsg("off");window.open("http:\/\/www.7stk.com\/","_blank","top=0,left=0,width=800,height=500,toolbar=yes,resizable=yes,scrollbars=yes")>欢迎访问<br>网页特效代码<\/font>\'); ');

  win.document.writeln(' } ');

  win.document.writeln(' document.write(\'<\/td><\/tr><\/table>\'); ');

  win.document.writeln('document.write(\'<table border="0" cellpadding="0" cellspacing="0" width="60" bgcolor="#C0C0C0" height="70">\');');

  win.document.writeln(' document.write(\'<tr><td valign="top" width="100%" height="100%">\');');

  win.document.writeln(' document.write(\'<table border="1" cellpadding="0" cellspacing="0" width="57" bgcolor="#FEFEEF" height="67">\');');

  win.document.writeln(' document.write(\'<tr><td align="center" width="100%" height="100%" onmouseover=getCalendarClockFreeCodeMsg("on")>\');');

  win.document.writeln(' document.write(\'<font id="calendarClock1" style="font-family:宋体;font-size:7pt;line-height:120%"> <\/font><br>\');');

  win.document.writeln(' document.write(\'<font id="calendarClock2" style="font-family:Arial;font-size:14pt;line-height:120%"> <\/font><br>\');');

  win.document.writeln(' document.write(\'<font id="calendarClock3" style="font-family:宋体;font-size:9pt;line-height:120%"> <\/font><br>\');');

  win.document.writeln(' document.write(\'<font id="calendarClock4" style="color:#100080;font-family:宋体;font-size:8pt;line-height:120%"><b> <\/b><\/font>\');');

  win.document.writeln(' document.write(\'<\/td><\/tr><\/table>\');');

  win.document.writeln(' document.write(\'<\/td><\/tr><\/table>\'); ');

  win.document.writeln(' document.write(\'<\/td><\/tr><\/table>\'); ');

  win.document.writeln(' setInterval(\'refreshCalendarClock()\',1000);');

  win.document.writeln('<\/script>');

  win.document.writeln('

 

0 Comments

Wed

18

Mar

2009

70、每天的提示语

70、每天的提示语

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

dayName = new Array ("星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六")

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

now = new Date

 

Jan = new Array

Jan[1] = "写下每天的提示语!!!"

Jan[2] = "写下每天的提示语!!!"

Jan[3] = "写下每天的提示语!!!"

Jan[4] = "写下每天的提示语!!!"

Jan[5] = "写下每天的提示语!!!"

Jan[6] = "写下每天的提示语!!!"

Jan[7] = "写下每天的提示语!!!"

Jan[8] = "写下每天的提示语!!!"

Jan[9] = "写下每天的提示语!!!"

Jan[10] = "写下每天的提示语!!!"

Jan[11] = "写下每天的提示语!!!"

Jan[12] = "写下每天的提示语!!!"

Jan[13] = "写下每天的提示语!!!"

Jan[14] = "写下每天的提示语!!!"

Jan[15] = "写下每天的提示语!!!"

Jan[16] = "写下每天的提示语!!!"

Jan[17] = "写下每天的提示语!!!"

Jan[18] = "写下每天的提示语!!!"

Jan[19] = "写下每天的提示语!!!"

Jan[20] = "写下每天的提示语!!!"

Jan[21] = "写下每天的提示语!!!"

Jan[22] = "写下每天的提示语!!!"

Jan[23] = "写下每天的提示语!!!"

Jan[24] = "写下每天的提示语!!!"

Jan[25] = "写下每天的提示语!!!"

Jan[26] = "写下每天的提示语!!!"

Jan[27] = "写下每天的提示语!!!"

Jan[28] = "写下每天的提示语!!!"

Jan[29] = "写下每天的提示语!!!"

Jan[30] = "写下每天的提示语!!!"

Jan[31] = "写下每天的提示语!!!"

 

Feb = new Array

Feb[1] = "写下每天的提示语!!!"

Feb[2] = "写下每天的提示语!!!"

Feb[3] = "写下每天的提示语!!!"

Feb[4] = "写下每天的提示语!!!"

Feb[5] = "写下每天的提示语!!!"

Feb[6] = "写下每天的提示语!!!"

Feb[7] = "写下每天的提示语!!!"

Feb[8] = "写下每天的提示语!!!"

Feb[9] = "写下每天的提示语!!!"

Feb[10] = "写下每天的提示语!!!"

Feb[11] = "写下每天的提示语!!!"

Feb[12] = "写下每天的提示语!!!"

Feb[13] = "写下每天的提示语!!!"

Feb[14] = "写下每天的提示语!!!"

Feb[15] = "写下每天的提示语!!!"

Feb[16] = "写下每天的提示语!!!"

Feb[17] = "写下每天的提示语!!!"

Feb[18] = "写下每天的提示语!!!"

Feb[19] = "写下每天的提示语!!!"

Feb[20] = "写下每天的提示语!!!"

Feb[21] = "写下每天的提示语!!!"

Feb[22] = "写下每天的提示语!!!"

Feb[23] = "写下每天的提示语!!!"

Feb[24] = "写下每天的提示语!!!"

Feb[25] = "写下每天的提示语!!!"

Feb[26] = "写下每天的提示语!!!"

Feb[27] = "写下每天的提示语!!!"

Feb[28] = "写下每天的提示语!!!"

Feb[29] = "写下每天的提示语!!!"

 

Mar = new Array

Mar[1] = "写下每天的提示语!!!"

Mar[2] = "写下每天的提示语!!!"

Mar[3] = "写下每天的提示语!!!"

Mar[4] = "写下每天的提示语!!!"

Mar[5] = "写下每天的提示语!!!"

Mar[6] = "写下每天的提示语!!!"

Mar[7] = "写下每天的提示语!!!"

Mar[8] = "写下每天的提示语!!!"

Mar[9] = "写下每天的提示语!!!"

Mar[10] = "写下每天的提示语!!!"

Mar[11] = "写下每天的提示语!!!"

Mar[12] = "写下每天的提示语!!!"

Mar[13] = "写下每天的提示语!!!"

Mar[14] = "写下每天的提示语!!!"

Mar[15] = "写下每天的提示语!!!"

Mar[16] = "写下每天的提示语!!!"

Mar[17] = "写下每天的提示语!!!"

Mar[18] = "写下每天的提示语!!!"

Mar[19] = "写下每天的提示语!!!"

Mar[20] = "写下每天的提示语!!!"

Mar[21] = "写下每天的提示语!!!"

Mar[22] = "写下每天的提示语!!!"

Mar[23] = "写下每天的提示语!!!"

Mar[24] = "写下每天的提示语!!!"

Mar[25] = "写下每天的提示语!!!"

Mar[26] = "写下每天的提示语!!!"

Mar[27] = "写下每天的提示语!!!"

Mar[28] = "写下每天的提示语!!!"

Mar[29] = "写下每天的提示语!!!"

Mar[30] = "写下每天的提示语!!!"

Mar[31] = "写下每天的提示语!!!"

 

Apr = new Array

Apr[1] = "写下每天的提示语!!!"

Apr[2] = "写下每天的提示语!!!"

Apr[3] = "写下每天的提示语!!!"

Apr[4] = "写下每天的提示语!!!"

Apr[5] = "写下每天的提示语!!!"

Apr[6] = "写下每天的提示语!!!"

Apr[7] = "写下每天的提示语!!!"

Apr[8] = "写下每天的提示语!!!"

Apr[9] = "写下每天的提示语!!!"

Apr[10] = "写下每天的提示语!!!"

Apr[11] = "写下每天的提示语!!!"

Apr[12] = "写下每天的提示语!!!"

Apr[13] = "写下每天的提示语!!!"

Apr[14] = "写下每天的提示语!!!"

Apr[15] = "写下每天的提示语!!!"

Apr[16] = "写下每天的提示语!!!"

Apr[17] = "写下每天的提示语!!!"

Apr[18] = "写下每天的提示语!!!"

Apr[19] = "写下每天的提示语!!!"

Apr[20] = "写下每天的提示语!!!"

Apr[21] = "写下每天的提示语!!!"

Apr[22] = "写下每天的提示语!!!"

Apr[23] = "写下每天的提示语!!!"

Apr[24] = "写下每天的提示语!!!"

Apr[25] = "写下每天的提示语!!!"

Apr[26] = "写下每天的提示语!!!"

Apr[27] = "写下每天的提示语!!!"

Apr[28] = "写下每天的提示语!!!"

Apr[29] = "写下每天的提示语!!!"

Apr[30] = "写下每天的提示语!!!"

 

May = new Array

May[1] = "写下每天的提示语!!!"

May[2] = "写下每天的提示语!!!"

May[3] = "写下每天的提示语!!!"

May[4] = "写下每天的提示语!!!"

May[5] = "写下每天的提示语!!!"

May[6] = "写下每天的提示语!!!"

May[7] = "写下每天的提示语!!!"

May[8] = "写下每天的提示语!!!"

May[9] = "写下每天的提示语!!!"

May[10] = "写下每天的提示语!!!"

May[11] = "写下每天的提示语!!!"

May[12] = "写下每天的提示语!!!"

May[13] = "写下每天的提示语!!!"

May[14] = "写下每天的提示语!!!"

May[15] = "写下每天的提示语!!!"

May[16] = "写下每天的提示语!!!"

May[17] = "写下每天的提示语!!!"

May[18] = "写下每天的提示语!!!"

May[19] = "写下每天的提示语!!!"

May[20] = "写下每天的提示语!!!"

May[21] = "写下每天的提示语!!!"

May[22] = "写下每天的提示语!!!"

May[23] = "写下每天的提示语!!!"

May[24] = "写下每天的提示语!!!"

May[25] = "写下每天的提示语!!!"

May[26] = "写下每天的提示语!!!"

May[27] = "写下每天的提示语!!!"

May[28] = "写下每天的提示语!!!"

May[29] = "写下每天的提示语!!!"

May[30] = "写下每天的提示语!!!"

May[31] = "写下每天的提示语!!!"

 

Jun = new Array

Jun[1] = "写下每天的提示语!!!"

Jun[2] = "写下每天的提示语!!!"

Jun[3] = "写下每天的提示语!!!"

Jun[4] = "写下每天的提示语!!!"

Jun[5] = "写下每天的提示语!!!"

Jun[6] = "写下每天的提示语!!!"

Jun[7] = "写下每天的提示语!!!"

Jun[8] = "写下每天的提示语!!!"

Jun[9] = "写下每天的提示语!!!"

Jun[10] = "写下每天的提示语!!!"

Jun[11] = "写下每天的提示语!!!"

Jun[12] = "写下每天的提示语!!!"

Jun[13] = "写下每天的提示语!!!"

Jun[14] = "写下每天的提示语!!!"

Jun[15] = "写下每天的提示语!!!"

Jun[16] = "写下每天的提示语!!!"

Jun[17] = "写下每天的提示语!!!"

Jun[18] = "写下每天的提示语!!!"

Jun[19] = "写下每天的提示语!!!"

Jun[20] = "写下每天的提示语!!!"

Jun[21] = "写下每天的提示语!!!"

Jun[22] = "写下每天的提示语!!!"

Jun[23] = "写下每天的提示语!!!"

Jun[24] = "写下每天的提示语!!!"

Jun[25] = "写下每天的提示语!!!"

Jun[26] = "写下每天的提示语!!!"

Jun[27] = "写下每天的提示语!!!"

Jun[28] = "写下每天的提示语!!!"

Jun[29] = "写下每天的提示语!!!"

Jun[30] = "写下每天的提示语!!!"

 

Jul = new Array

Jul[1] = "写下每天的提示语!!!"

Jul[2] = "写下每天的提示语!!!"

Jul[3] = "写下每天的提示语!!!"

Jul[4] = "写下每天的提示语!!!"

Jul[5] = "写下每天的提示语!!!"

Jul[6] = "写下每天的提示语!!!"

Jul[7] = "写下每天的提示语!!!"

Jul[8] = "写下每天的提示语!!!"

Jul[9] = "写下每天的提示语!!!"

Jul[10] = "写下每天的提示语!!!"

Jul[11] = "写下每天的提示语!!!"

Jul[12] = "写下每天的提示语!!!"

Jul[13] = "写下每天的提示语!!!"

Jul[14] = "写下每天的提示语!!!"

Jul[15] = "写下每天的提示语!!!"

Jul[16] = "写下每天的提示语!!!"

Jul[17] = "写下每天的提示语!!!"

Jul[18] = "写下每天的提示语!!!"

Jul[19] = "写下每天的提示语!!!"

Jul[20] = "写下每天的提示语!!!"

Jul[21] = "写下每天的提示语!!!"

Jul[22] = "写下每天的提示语!!!"

Jul[23] = "写下每天的提示语!!!"

Jul[24] = "写下每天的提示语!!!"

Jul[25] = "写下每天的提示语!!!"

Jul[26] = "写下每天的提示语!!!"

Jul[27] = "写下每天的提示语!!!"

Jul[28] = "写下每天的提示语!!!"

Jul[29] = "写下每天的提示语!!!"

Jul[30] = "写下每天的提示语!!!"

Jul[31] = "写下每天的提示语!!!"

 

Aug = new Array

Aug[1] = "写下每天的提示语!!!"

Aug[2] = "写下每天的提示语!!!"

Aug[3] = "写下每天的提示语!!!"

Aug[4] = "写下每天的提示语!!!"

Aug[5] = "写下每天的提示语!!!"

Aug[6] = "写下每天的提示语!!!"

Aug[7] = "写下每天的提示语!!!"

Aug[8] = "写下每天的提示语!!!"

Aug[9] = "写下每天的提示语!!!"

Aug[10] = "写下每天的提示语!!!"

Aug[11] = "写下每天的提示语!!!"

Aug[12] = "写下每天的提示语!!!"

Aug[13] = "写下每天的提示语!!!"

Aug[14] = "写下每天的提示语!!!"

Aug[15] = "写下每天的提示语!!!"

Aug[16] = "写下每天的提示语!!!"

Aug[17] = "写下每天的提示语!!!"

Aug[18] = "写下每天的提示语!!!"

Aug[19] = "写下每天的提示语!!!"

Aug[20] = "写下每天的提示语!!!"

Aug[21] = "写下每天的提示语!!!"

Aug[22] = "写下每天的提示语!!!"

Aug[23] = "写下每天的提示语!!!"

Aug[24] = "写下每天的提示语!!!"

Aug[25] = "写下每天的提示语!!!"

Aug[27] = "写下每天的提示语!!!"

Aug[28] = "写下每天的提示语!!!"

Aug[29] = "写下每天的提示语!!!"

Aug[30] = "写下每天的提示语!!!"

Aug[31] = "写下每天的提示语!!!"

 

Sep = new Array

Sep[1] = "写下每天的提示语!!!"

Sep[2] = "写下每天的提示语!!!"

Sep[3] = "写下每天的提示语!!!"

Sep[4] = "写下每天的提示语!!!"

Sep[5] = "写下每天的提示语!!!"

Sep[6] = "写下每天的提示语!!!"

Sep[7] = "写下每天的提示语!!!"

Sep[8] = "写下每天的提示语!!!"

Sep[9] = "写下每天的提示语!!!"

Sep[10] = "写下每天的提示语!!!"

Sep[11] = "写下每天的提示语!!!"

Sep[12] = "写下每天的提示语!!!"

Sep[13] = "写下每天的提示语!!!"

Sep[14] = "写下每天的提示语!!!"

Sep[15] = "写下每天的提示语!!!"

Sep[16] = "写下每天的提示语!!!"

Sep[17] = "写下每天的提示语!!!"

Sep[18] = "写下每天的提示语!!!"

Sep[19] = "写下每天的提示语!!!"

Sep[20] = "写下每天的提示语!!!"

Sep[21] = "写下每天的提示语!!!"

Sep[22] = "写下每天的提示语!!!"

Sep[23] = "写下每天的提示语!!!"

Sep[24] = "写下每天的提示语!!!"

Sep[25] = "写下每天的提示语!!!"

Sep[26] = "写下每天的提示语!!!"

Sep[27] = "写下每天的提示语!!!"

Sep[28] = "写下每天的提示语!!!"

Sep[29] = "写下每天的提示语!!!"

Sep[30] = "写下每天的提示语!!!"

 

Oct = new Array

Oct[1] = "写下每天的提示语!!!"

Oct[2] = "写下每天的提示语!!!"

Oct[3] = "写下每天的提示语!!!"

Oct[4] = "写下每天的提示语!!!"

Oct[5] = "写下每天的提示语!!!"

Oct[6] = "写下每天的提示语!!!"

Oct[7] = "写下每天的提示语!!!"

Oct[8] = "写下每天的提示语!!!"

Oct[9] = "写下每天的提示语!!!"

Oct[10] = "写下每天的提示语!!!"

Oct[11] = "写下每天的提示语!!!"

Oct[12] = "写下每天的提示语!!!"

Oct[13] = "写下每天的提示语!!!"

Oct[14] = "写下每天的提示语!!!"

Oct[15] = "写下每天的提示语!!!"

Oct[16] = "写下每天的提示语!!!"

Oct[17] = "写下每天的提示语!!!"

Oct[18] = "写下每天的提示语!!!"

Oct[19] = "写下每天的提示语!!!"

Oct[20] = "写下每天的提示语!!!"

Oct[21] = "写下每天的提示语!!!"

Oct[22] = "写下每天的提示语!!!"

Oct[23] = "写下每天的提示语!!!"

Oct[24] = "写下每天的提示语!!!"

Oct[25] = "写下每天的提示语!!!"

Oct[26] = "写下每天的提示语!!!"

Oct[27] = "写下每天的提示语!!!"

Oct[28] = "写下每天的提示语!!!"

Oct[29] = "写下每天的提示语!!!"

Oct[30] = "写下每天的提示语!!!"

Oct[31] = "写下每天的提示语!!!"

 

Nov = new Array

Nov[1] = "写下每天的提示语!!!"

Nov[2] = "写下每天的提示语!!!"

Nov[3] = "写下每天的提示语!!!"

Nov[4] = "写下每天的提示语!!!"

Nov[5] = "写下每天的提示语!!!"

Nov[6] = "写下每天的提示语!!!"

Nov[7] = "写下每天的提示语!!!"

Nov[8] = "写下每天的提示语!!!"

Nov[9] = "写下每天的提示语!!!"

Nov[10] = "写下每天的提示语!!!"

Nov[11] = "写下每天的提示语!!!"

Nov[12] = "写下每天的提示语!!!"

Nov[13] = "写下每天的提示语!!!"

Nov[14] = "写下每天的提示语!!!"

Nov[15] = "写下每天的提示语!!!"

Nov[16] = "写下每天的提示语!!!"

Nov[17] = "写下每天的提示语!!!"

Nov[18] = "写下每天的提示语!!!"

Nov[19] = "写下每天的提示语!!!"

Nov[20] = "写下每天的提示语!!!"

Nov[21] = "今天是21号,今天没有什么重要消息"

Nov[22] = "写下每天的提示语!!!"

Nov[23] = "写下每天的提示语!!!"

Nov[24] = "写下每天的提示语!!!"

Nov[25] = "写下每天的提示语!!!"

Nov[26] = "写下每天的提示语!!!"

Nov[27] = "写下每天的提示语!!!"

Nov[28] = "写下每天的提示语!!!"

Nov[29] = "写下每天的提示语!!!"

Nov[30] = "写下每天的提示语!!!"

 

Dec = new Array

Dec[1] = "写下每天的提示语!!!"

Dec[2] = "写下每天的提示语!!!"

Dec[3] = "写下每天的提示语!!!"

Dec[4] = "写下每天的提示语!!!"

Dec[5] = "写下每天的提示语!!!"

Dec[6] = "写下每天的提示语!!!"

Dec[7] = "写下每天的提示语!!!"

Dec[8] = "写下每天的提示语!!!"

Dec[9] = "写下每天的提示语!!!"

Dec[10] = "写下每天的提示语!!!"

Dec[11] = "写下每天的提示语!!!"

Dec[12] = "写下每天的提示语!!!"

Dec[13] = "写下每天的提示语!!!"

Dec[14] = "写下每天的提示语!!!"

Dec[15] = "写下每天的提示语!!!"

Dec[16] = "写下每天的提示语!!!"

Dec[17] = "写下每天的提示语!!!"

Dec[18] = "写下每天的提示语!!!"

Dec[19] = "写下每天的提示语!!!"

Dec[20] = "写下每天的提示语!!!"

Dec[21] = "写下每天的提示语!!!"

Dec[22] = "写下每天的提示语!!!"

Dec[23] = "写下每天的提示语!!!"

Dec[24] = "写下每天的提示语!!!"

Dec[25] = "写下每天的提示语!!!"

Dec[26] = "写下每天的提示语!!!"

Dec[27] = "写下每天的提示语!!!"

Dec[28] = "写下每天的提示语!!!"

Dec[29] = "写下每天的提示语!!!"

Dec[30] = "写下每天的提示语!!!"

Dec[31] = "写下每天的提示语!!!"

//  End -->

</script>

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

document.write("<Font color=#333366>")

document.write("<center><B><I>" + dayName[now.getDay()] + ", " + monName[now.getMonth()] + " " + now.getDate() + ", " + now.getFullYear() + ".</I></B></center><BR>" )

document.write("<Font size=5>")

if (now.getMonth() == 0) document.write("<center><i>&quot;" + Jan[now.getDate()] + "&quot;</i></center>")

if (now.getMonth() == 1) document.write("<center><i>&quot;" + Feb[now.getDate()] + "&quot;</i></center>")

if (now.getMonth() == 2) document.write("<center><i>&quot;" + Mar[now.getDate()] + "&quot;</i></center>")

if (now.getMonth() == 3) document.write("<center><i>&quot;" + Apr[now.getDate()] + "&quot;</i></center>")

if (now.getMonth() == 4) document.write("<center><i>&quot;" + May[now.getDate()] + "&quot;</i></center>")

if (now.getMonth() == 5) document.write("<center><i>&quot;" + Jun[now.getDate()] + "&quot;</i></center>")

if (now.getMonth() == 6) document.write("<center><i>&quot;" + Jul[now.getDate()] + "&quot;</i></center>")

if (now.getMonth() == 7) document.write("<center><i>&quot;" + Aug[now.getDate()] + "&quot;</i></center>")

if (now.getMonth() == 8) document.write("<center><i>&quot;" + Sep[now.getDate()] + "&quot;</i></center>")

if (now.getMonth() == 9) document.write("<center><i>&quot;" + Oct[now.getDate()] + "&quot;</i></center>")

if (now.getMonth() == 10) document.write("<center><i>&quot;" + Nov[now.getDate()] + "&quot;</i></center>")

if (now.getMonth() == 11) document.write("<center><i>&quot;" + Dec[now.getDate()] + "&quot;</i></center>")

document.write("</Font>")

document.write("<P align=center><B><I>~ 冰峰 ~</I></B></P>")

document.write("</Font>")

//  End -->

</script>

 

0 Comments

Wed

18

Mar

2009

69、全面时间的显示

69、全面时间的显示

脚本说明:

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

<div align="center">

<font face="Arial, Helvetica, Sans Serif" size="3" color="#0000FF"><b>

<span id="clock">

 

<SCRIPT LANGUAGE="JavaScript">

 

<!-- Begin

var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")

var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")

function getthedate(){

var mydate=new Date()

var year=mydate.getYear()

if (year < 1000)

year+=1900

var day=mydate.getDay()

var month=mydate.getMonth()

var daym=mydate.getDate()

if (daym<10)

daym="0"+daym

var hours=mydate.getHours()

var minutes=mydate.getMinutes()

var seconds=mydate.getSeconds()

var dn="AM"

if (hours>=12)

dn="PM"

if (hours>12){

hours=hours-12

}

{

 d = new Date();

 Time24H = new Date();

 Time24H.setTime(d.getTime() + (d.getTimezoneOffset()*60000) + 3600000);

 InternetTime = Math.round((Time24H.getHours()*60+Time24H.getMinutes()) / 1.44);

 if (InternetTime < 10) InternetTime = '00'+InternetTime;

 else if (InternetTime < 100) InternetTime = '0'+InternetTime;

}

if (hours==0)

hours=12

if (minutes<=9)

minutes="0"+minutes

if (seconds<=9)

seconds="0"+seconds

//change font size here

var cdate=dayarray[day]+", "+montharray[month]+" "+daym+" "+year+" | "+hours+":"+minutes+":"+seconds+" "+dn+" | @"+InternetTime+""

if (document.all)

document.all.clock.innerHTML=cdate

else if (document.getElementById)

document.getElementById("clock").innerHTML=cdate

else

document.write(cdate)

}

if (!document.all&&!document.getElementById)

getthedate()

function goforit(){

if (document.all||document.getElementById)

setInterval("getthedate()",1000)

}

window.onload=goforit

//  End -->

</script>

 

</span>

</b>

</font>

</div>

 

0 Comments

Wed

18

Mar

2009

68、时间各地时间显示

68、时间各地时间显示

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

var timerID ;

function tzone(tz, os, ds, cl)

{

       this.ct = new Date(0) ;          // datetime

       this.tz = tz ;           // code

       this.os = os ;          // GMT offset

       this.ds = ds ;          // has daylight savings

       this.cl = cl ;           // font color

}

function UpdateClocks()

{    

       var ct = new Array(

              new tzone('SFO: ', -8, 1, 'lime'),

              new tzone('TYO: ', +9, 0, 'violet'),

              new tzone('HKG: ', +8, 0, 'cyan'),

              new tzone('BKK: ', +7, 0, 'yellow'),

              new tzone('NYC: ', -5, 1, '#FFAA00'),

              new tzone('LON: ',  0, 1, 'silver'),

              new tzone('SVO: ', +3, 0, 'pink'),

              new tzone('KTM: ', +5.75, 0, 'red')

       ) ;

       var dt = new Date() ;     // [GMT] time according to machine clock

       var startDST = new Date(dt.getFullYear(), 3, 1) ;

       while (startDST.getDay() != 0)

              startDST.setDate(startDST.getDate() + 1) ;

       var endDST = new Date(dt.getFullYear(), 9, 31) ;

       while (endDST.getDay() != 0)

              endDST.setDate(endDST.getDate() - 1) ;

       var ds_active ;        // DS currently active

       if (startDST < dt && dt < endDST)

              ds_active = 1 ;

       else

              ds_active = 0 ;

       // Adjust each clock offset if that clock has DS and in DS.

       for(n=0 ; n<ct.length ; n++)

              if (ct[n].ds == 1 && ds_active == 1) ct[n].os++ ;

       // compensate time zones

       gmdt = new Date() ;

       for (n=0 ; n<ct.length ; n++)

              ct[n].ct = new Date(gmdt.getTime() + ct[n].os * 3600 * 1000) ;

       document.all.Clock0.innerHTML =

              '<font color="' + ct[0].cl + '">' + ct[0].tz + ClockString(ct[0].ct) + '</font>' ;

       document.all.Clock1.innerHTML =

              '<font color="' + ct[1].cl + '">' + ct[1].tz + ClockString(ct[1].ct) + '</font>' ;

       document.all.Clock2.innerHTML =

              '<font color="' + ct[2].cl + '">' + ct[2].tz + ClockString(ct[2].ct) + '</font>' ;

       document.all.Clock3.innerHTML =

              '<font color="' + ct[3].cl + '">' + ct[3].tz + ClockString(ct[3].ct) + '</font>' ;

       document.all.Clock4.innerHTML =

              '<font color="' + ct[4].cl + '">' + ct[4].tz + ClockString(ct[4].ct) + '</font>' ;

       document.all.Clock5.innerHTML =

              '<font color="' + ct[5].cl + '">' + ct[5].tz + ClockString(ct[5].ct) + '</font>' ;

       document.all.Clock6.innerHTML =

              '<font color="' + ct[6].cl + '">' + ct[6].tz + ClockString(ct[6].ct) + '</font>' ;

       document.all.Clock7.innerHTML =

              '<font color="' + ct[7].cl + '">' + ct[7].tz + ClockString(ct[7].ct) + '</font>' ;

       timerID = window.setTimeout("UpdateClocks()", 1001) ;

}

function ClockString(dt)

{

var stemp, ampm ;

       var dt_year = dt.getUTCFullYear() ;

       var dt_month = dt.getUTCMonth() + 1 ;

       var dt_day = dt.getUTCDate() ;

 

       var dt_hour = dt.getUTCHours() ;

 

       var dt_minute = dt.getUTCMinutes() ;

 

       var dt_second = dt.getUTCSeconds() ;

 

      

 

       dt_year = dt_year.toString() ;

 

       if (0 <= dt_hour && dt_hour < 12)

 

       {

 

              ampm = 'AM' ;

 

              if (dt_hour == 0) dt_hour = 12 ;         

 

       } else {

 

              ampm = 'PM' ;

 

              dt_hour = dt_hour - 12 ;

 

              if (dt_hour == 0) dt_hour = 12 ;         

 

       }

 

      

 

       if (dt_minute < 10)

 

              dt_minute = '0' + dt_minute ;

 

      

 

       if (dt_second < 10)

 

              dt_second = '0' + dt_second ;

 

 

 

       stemp = dt_month + '/' + dt_day + '/' + dt_year.substr(2,2) ;

 

       stemp = stemp + ' ' + dt_hour + ":" + dt_minute + ":" + dt_second + ' ' + ampm ;

 

       return stemp ;

}

//  End -->

</script>

 

<table border="0" cellspacing="0" width="100%">

 

  <tr bgcolor="#000000" style="font-family: Verdana, Tahoma, Arial; font-size: x-small">

 

    <td ID="Clock0" width="25%" >   </td>

 

    <td ID="Clock1" width="25%" >   </td>

 

    <td ID="Clock2" width="25%" >   </td>

 

    <td ID="Clock3" width="25%" >   </td>

 

  </tr>

 

  <tr bgcolor="#000000" style="font-family: Verdana, Tahoma, Arial; font-size: x-small">

 

    <td ID="Clock4" width="25%" >   </td>

 

    <td ID="Clock5" width="25%" >   </td>

 

    <td ID="Clock6" width="25%" >   </td>

 

    <td ID="Clock7" width="25%" >   </td>

 

  </tr>

 

</table>

 

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

<body  onLoad="UpdateClocks()">

 

0 Comments

Wed

18

Mar

2009

67、全球时间-酷

67、全球时间-

 

 

0 Comments

Wed

18

Mar

2009

66、计算星座与属相

66、计算星座与属相

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

function signs() {

var start = 1901, birthyear = document.zodiac.year.value, date=document.zodiac.date.value, month=document.zodiac.month.selectedIndex;

 

with (document.zodiac.sign){

 

if (month == 1 && date >=20 || month == 2 && date <=18) {value = "水瓶座";}

if (month == 1 && date > 31) {value = "Huh?";}

if (month == 2 && date >=19 || month == 3 && date <=20) {value = "双鱼座";}

if (month == 2 && date > 29) {value = "Say what?";}

if (month == 3 && date >=21 || month == 4 && date <=19) {value = "白羊座";}

if (month == 3 && date > 31) {value = "OK.  Whatever.";}

if (month == 4 && date >=20 || month == 5 && date <=20) {value = "金牛座";}

if (month == 4 && date > 30) {value = "I'm soooo sorry!";}

if (month == 5 && date >=21 || month == 6 && date <=21) {value = "双子座";}

if (month == 5 && date > 31) {value = "Umm ... no.";}

if (month == 6 && date >=22 || month == 7 && date <=22) {value = "巨蟹座";}

if (month == 6 && date > 30) {value = "Sorry.";}

if (month == 7 && date >=23 || month == 8 && date <=22) {value = "狮子座";}

if (month == 7 && date > 31) {value = "Excuse me?";}

if (month == 8 && date >=23 || month == 9 && date <=22) {value = "室女座";}

if (month == 8 && date > 31) {value = "Yeah. Right.";}

if (month == 9 && date >=23 || month == 10 && date <=22) {value = "天秤座";}

if (month == 9 && date > 30) {value = "Try Again.";}

if (month == 10 && date >=23 || month == 11 && date <=21) {value = "天蝎座";}

if (month == 10 && date > 31) {value = "Forget it!";}

if (month == 11 && date >=22 || month == 12 && date <=21) {value = "人马座";}

if (month == 11 && date > 30) {value = "Invalid Date";}

if (month == 12 && date >=22 || month == 1 && date <=19) {value = "摩羯座";}

if (month == 12 && date > 31) {value = "No way!";}

}

x = (start - birthyear) % 12

with (document.zodiac.csign){

if (x == 1 || x == -11) {value = "老鼠";}

if (x == 0) {value = "";}

if (x == 11 || x == -1) {value = "老虎";}

if (x == 10 || x == -2) {value = "兔子";}

if (x == 9 || x == -3)  {value = "";}

if (x == 8 || x == -4)  {value ="";}

if (x == 7 || x == -5)  {value = "";}

if (x == 6 || x == -6)  {value = "";}

if (x == 5 || x == -7)  {value = "猴子";}

if (x == 4 || x == -8)  {value = "";}

if (x == 3 || x == -9)  {value = "";}

if (x == 2 || x == -10)  {value = "";} 

 

}

}

//  End -->

</script>

<form name="zodiac">

<center>

<table bgcolor="#eeaa00" border="2" bordercolor="#000000" rules="none" cellspacing="0" cellpadding="4">

       <tr><td><b><i>出生年份</i></b></td>

       <td><div align="right"><input type="text" size="10" name="year" value="出生年份" onClick=value=""></div></td>

       <td><!--This empty field is just for appearance--></td>

       <tr><td><b><i>出生月份</i></b></td>

       <td><div align="right">

<select name="month">

<option value="x">请选择一个月份</option>

<option value="1">一月</option><option value="2">二月</option><option value="3">三月</option>

<option value="4">四月</option><option value="5">五月</option><option value="6">六月</option>

<option value="7">七月</option><option value="8">八月</option><option value="9">九月</option>

<option value="10">十月</option><option value="11">十一月</option>

<option value="12">十二月</option></select></div></td>

       <td><!--This empty field is just for appearance--></td></tr>

       <tr><td><b><i></i></b></td>

       <td><div align="right"><input type="text" name="date" value="" size="3" onClick=value=""></td>

       <td><input type="button" value="计算一下" onClick="signs()"></div></td></tr>

       <tr><td><b><i>星座:</i></b></td>

       <td><div align="right"><input type="text" name="sign" size="12" value="" align="right"></div></td></tr>

       <td><!--This empty field is just for appearance--></td></tr>

       <tr><td><b><i>属相:</i></b></td>

       <td><div align="right"><input type="text" name="csign" size="12"></div></td>

       <td><!--This empty field is just for appearance--></td></tr>

 

</table>

</center>

</form>

 

0 Comments

Wed

18

Mar

2009

65、最简单的时钟

65、最简单的时钟

脚本说明:

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

<script LANGUAGE="JavaScript">

function clock()

{

now=new Date();

document.clock.time.value=now.toLocaleString().split(" ")[1];

document.clock.date.value=now.toLocaleString().split(" ")[0];

setTimeout("clock()",100);

}

</script>

<form name="clock">

time: <input type="text" name="time" size="8" value=""><br>

date: <input type="text" name="date" size="8" value="">

</form>

 

 

第二步:把<body>中的代码改为:

<body  onload="clock()">

 

0 Comments

Wed

18

Mar

2009

64、超长日历表单

64、超长日历表单

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

var now = new Date();

var month_array = new Array("january","february","march","April","May","June","July","August","September","October","November","December");

document.write("<form name=date_list><table bgcolor=silver><tr><td>");

document.write("<select name=month onchange=change_month(this.options.selectedIndex)>");

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

{

 if (now.getMonth() != i)

 {document.write ("<option value="+i+">"+month_array[i]);}

 else

 {document.write ("<option value="+i+" selected>"+month_array[i]);}

 

}

document.write("</select>");

document.write("</td><td>");

document.write ("<select name=year onchange=change_year(this.options[this.options.selectedIndex])>");

for(i=1950;i<3000;i++)

{

 if (now.getYear() != i)

 {document.write("<option value="+i+">"+i);}

 else

 {document.write("<option value="+i+" selected>"+i);}

}

document.write("</select></td></tr><tr><td colspan=2><center>");

 

document.write("<table bgcolor=white border=0 cellspacing = 0 cellpading = 0 width=100%><tr bgcolor=gray align=center>");

document.write("<td><font color=silver>M</font></td><td><font color=silver>T</td><td><font color=silver>W</td><td><font color=silver>T</td><td><font color=silver>F</td><td ><font color=silver>S</td><td ><font color=silver>S</td>");

document.write("</tr><tr>");

for(j=0;j<6;j++)

{

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

 {

   document.write("<td align=center id=d"+i+"r"+j+"></td>")

 }

 document.write("</tr>");

}

 

document.write("</table>");

 

document.write("</center></form></td></tr></table>");

 

var show_date = new Date();

 

function set_cal(show_date)

{

begin_day = new Date (show_date.getYear(),show_date.getMonth(),1);

begin_day_date = begin_day.getDay();

end_day = new Date (show_date.getYear(),show_date.getMonth()+1,1);

count_day = (end_day - begin_day)/1000/60/60/24;

input_table(begin_day_date,count_day);

}

set_cal(show_date);

 

function input_table(begin,count)

{

init();

j=0;

if (begin!=0){i=begin-1;}else{i=6}

for (c=1;c<count+1;c++)

{

 colum_name = eval("d"+i+"r"+j);

 if ((now.getDate() == c)&&(show_date.getMonth() == now.getMonth())&&(show_date.getYear() == now.getYear())) {colum_name.style.backgroundColor = "blue";colum_name.style.color = "white";};

 colum_name.innerText =  c;

 i++;

 if (i==7){i=0;j++;}

}

}

 

function init()

{

for(j=0;j<6;j++)

{

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

 {

 colum_name = eval("d"+i+"r"+j);

 colum_name.innerText =  "-";

 colum_name.style.backgroundColor ="";

 colum_name.style.color ="";

 }

}

}

 

function change_month(sel_month)

{

show_date = new Date(show_date.getYear(),sel_month,1);

set_cal(show_date);

}

 

function change_year(sel_year)

{

sel_year = sel_year.value;

show_date = new Date(sel_year,show_date.getMonth(),1);

set_cal(show_date);

}

//  End -->

</script>

 

0 Comments

Wed

18

Mar

2009

63、时间的特殊显示

63、时间的特殊显示

脚本说明:

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

<script>

function tick() {

var hours, minutes, seconds, xfile;

var intHours, intMinutes, intSeconds;

var today;

today = new Date();

intHours = today.getHours();

intMinutes = today.getMinutes();

intSeconds = today.getSeconds();

if (intHours == 0) {

hours = "12:";

xfile = "午夜";

} else if (intHours < 12) {

hours = intHours+":";

xfile = "上午";

} else if (intHours == 12) {

hours = "12:";

xfile = "正午";

} else {

intHours = intHours - 12

hours = intHours + ":";

xfile = "下午";

}

if (intMinutes < 10) {

minutes = "0"+intMinutes+":";

} else {

minutes = intMinutes+":";

}

if (intSeconds < 10) {

seconds = "0"+intSeconds+" ";

} else {

seconds = intSeconds+" ";

}

timeString = xfile+hours+minutes+seconds;

Clock.innerHTML = timeString;

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

}

window.onload = tick;

</script>

<font id="Clock" align="center" style="font-size: 20; color:#000000"></font>

 

0 Comments

Wed

18

Mar

2009

62、特酷的文字时间显示

62、特酷的文字时间显示

脚本说明:

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

<style>

<!--

.styling{

background-color:black;

color:lime;

font: bold 16px MS Sans Serif;

padding: 3px;

}

-->

</style>

<span id="digitalclock" class="styling"></span>

 

<script>

<!--

 

var alternate=0

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

 

if (standardbrowser)

document.write('<form name="tick"><input type="text" name="tock" size="11"></form>')

 

function show(){

if (!standardbrowser)

var clockobj=document.getElementById? document.getElementById("digitalclock") : document.all.digitalclock

var Digital=new Date()

var hours=Digital.getHours()

var minutes=Digital.getMinutes()

var dn="AM"

 

if (hours==12) dn="PM"

if (hours>12){

dn="PM"

hours=hours-12

}

if (hours==0) hours=12

if (hours.toString().length==1)

hours="0"+hours

if (minutes<=9)

minutes="0"+minutes

 

if (standardbrowser){

if (alternate==0)

document.tick.tock.value=hours+" : "+minutes+" "+dn

else

document.tick.tock.value=hours+"   "+minutes+" "+dn

}

else{

if (alternate==0)

clockobj.innerHTML=hours+"<font color='lime'>&nbsp;:&nbsp;</font>"+minutes+" "+"<sup style='font-size:1px'>"+dn+"</sup>"

else

clockobj.innerHTML=hours+"<font color='black'>&nbsp;:&nbsp;</font>"+minutes+" "+"<sup style='font-size:1px'>"+dn+"</sup>"

}

alternate=(alternate==0)? 1 : 0

setTimeout("show()",1000)

}

window.onload=show

 

//-->

</script>

 

0 Comments

Wed

18

Mar

2009

61、小巧实用的鼠标时钟

61、小巧实用的鼠标时钟

脚本说明:

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

<script language="JavaScript">

 

dCol='000000';//date colour.

 

fCol='000000';//face colour.

 

sCol='000000';//seconds colour.

 

mCol='000000';//minutes colour.

 

hCol='000000';//hours colour.

 

ClockHeight=40;

 

ClockWidth=40;

 

ClockFromMouseY=0;

 

ClockFromMouseX=100;

 

 

 

//Alter nothing below! Alignments will be lost!

 

 

 

d=new Array("SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY");

 

m=new Array("JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER");

 

date=new Date();

 

day=date.getDate();

 

year=date.getYear();

 

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

 

TodaysDate=" "+d[date.getDay()]+" "+day+" "+m[date.getMonth()]+" "+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+"><B>";

 

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

 

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]+'</B></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]+'</B></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()',20);

 

}

 

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

 

</script>

 

0 Comments