%26lt;!-- http://js.knowsky.com/ --%26gt; %26lt;!-- http://bbs.knowsky.com/--%26gt; %26lt;title%26gt; 温度计式样的时间 %26lt;/title%26gt; %26lt;SCRIPT language=javascript%26gt; var cellwidth=10; // EACH "CELL" WIDTH IN PIXELS var cellheight=10; // EACH "CELL" HEIGHT IN PIXELS var fontsize=11; // FONT SIZE OF THE NUMBERS. SETTING THIS TOO BIG CAUSES UNDESIRED EFFECTS. var fontcolor="080080"; // ENTER ANY HTML or RGB COLOR CODE var fontstyle="bold"; // ENTER EITHER BOLD, ITALICS, NONE var oncolor="red"; // COLOR OF ACTIVE CELLS var offcolor="lightgrey"; // COLOR OF INACTIVE CELLS //more javascript http://www.knowsky.com var NS4 = (navigator.appName.indexOf("Netscape")%26gt;=0 %26amp;%26amp; parseFloat(navigator.appVersion) %26gt;= 4 %26amp;%26amp; parseFloat(navigator.appVersion) %26lt; 5)? true : false; var IE4 = (document.all)? true : false; var NS6 = (parseFloat(navigator.appVersion) %26gt;= 5 %26amp;%26amp; navigator.appName.indexOf("Netscape")%26gt;=0 )? true: false; var binclk, now; var t='%26lt;table cellspacing="1" cellpadding="0" border="0"%26gt;%26lt;tr%26gt;%26lt;td align="center"%26gt; %26lt;/td%26gt;'; for(i=0;i%26lt;=58;i+=2)t+='%26lt;td align="left" colspan="2"%26gt;%26lt;font style="font-size:'+fontsize+'px; font-weight:'+fontstyle+'; color: '+fontcolor+'"%26gt;'+i+'%26lt;br%26gt; |%26lt;/font%26gt;%26lt;/td%26gt;'; t+='%26lt;td%26gt; %26lt;/td%26gt;%26lt;/tr%26gt;%26lt;tr%26gt;%26lt;td align="center"%26gt;%26lt;font style="font-size:'+fontsize+'px; font-weight:'+fontstyle+'; color: '+fontcolor+'"%26gt;时: %26lt;/font%26gt;%26lt;/td%26gt;'; for(i=0;i%26lt;=23;i++){ t+='%26lt;td%26gt;'; t+=(NS4)? '%26lt;ilayer name="hrs'+i+'" height="'+cellheight+'" width="'+cellwidth+'" bgcolor="'+offcolor+'"%26gt;%26lt;/ilayer%26gt;' : '%26lt;div id="hrs'+i+'" style="position:relative; width:'+cellwidth+'px; font-size:1px; height:'+cellheight+'px; background-color:'+offcolor+'"%26gt;%26lt;/div%26gt;'; t+='%26lt;/td%26gt;'; } t+='%26lt;td colspan="36"%26gt;%26lt;td%26gt; %26lt;/td%26gt;%26lt;/tr%26gt;%26lt;tr%26gt;%26lt;td align="center"%26gt;%26lt;font style="font-size:'+fontsize+'px; font-weight:'+fontstyle+'; color: '+fontcolor+'"%26gt;分: %26lt;/font%26gt;%26lt;/td%26gt;'; for(i=0;i%26lt;=59;i++){ t+='%26lt;td%26gt;'; t+=(NS4)? '%26lt;ilayer name="min'+i+'" width="'+cellwidth+'" height="'+cellheight+'" bgcolor="'+offcolor+'"%26gt;%26lt;/ilayer%26gt;' : '%26lt;div id="min'+i+'" style="position:relative; width:'+cellwidth+'px; font-size:1px; height:'+cellheight+'px; background-color:'+offcolor+'"%26gt;%26lt;/div%26gt;'; t+='%26lt;/td%26gt;'; } t+='%26lt;td%26gt; %26lt;/td%26gt;%26lt;/tr%26gt;%26lt;tr%26gt;%26lt;td align="center"%26gt;%26lt;font style="font-size:'+fontsize+'px; font-weight:'+fontstyle+'; color: '+fontcolor+'"%26gt;秒: %26lt;/font%26gt;%26lt;/td%26gt;'; for(i=0;i%26lt;=59;i++) { t+='%26lt;td%26gt;'; t+=(NS4)? '%26lt;ilayer name="sec'+i+'" width="'+cellwidth+'" height="'+cellheight+'" bgcolor="'+offcolor+'"%26gt;%26lt;/ilayer%26gt;' : '%26lt;div id="sec'+i+'" style="position:relative; width:'+cellwidth+'px; font-size:1px; height:'+cellheight+'px; background-color:'+offcolor+'"%26gt;%26lt;/div%26gt;'; t+='%26lt;/td%26gt;'; } t+='%26lt;td%26gt; %26lt;/td%26gt;%26lt;/tr%26gt;%26lt;tr%26gt;%26lt;td%26gt; %26lt;/td%26gt;%26lt;td%26gt; %26lt;/td%26gt;'; for(i=1;i%26lt;=59;i+=2)t+='%26lt;td align="left" colspan="2"%26gt;%26lt;font style="font-size:'+fontsize+'px; font-weight:'+fontstyle+'; color: '+fontcolor+'"%26gt; |%26lt;br%26gt;'+i+'%26lt;/font%26gt;%26lt;/td%26gt;'; t+='%26lt;/tr%26gt;%26lt;/table%26gt;'; document.write(t); function init(){ getvals(); for(i=0;i%26lt;=now.h;i++)setbgcolor('hrs'+i, oncolor); for(i=0;i%26lt;=now.m;i++)setbgcolor('min'+i, oncolor); for(i=0;i%26lt;=now.s;i++)setbgcolor('sec'+i, oncolor); setInterval('setclock()', 100); } function getvals(){ now=new Date(); now.s=now.getSeconds(); now.h=now.getHours(); now.m=now.getMinutes(); } function setclock(){ getvals(); if((now.h==0)%26amp;%26amp;(now.m==0)) for(i=1;i%26lt;=23;i++)setbgcolor('hrs'+i, offcolor); if((now.s==0)%26amp;%26amp;(now.m==0)) for (i=1;i%26lt;=59;i++)setbgcolor('min'+i, offcolor); if(now.s==0) for(i=1;i%26lt;=59;i++)setbgcolor('sec'+i, offcolor); setbgcolor('hrs'+now.h, oncolor); setbgcolor('min'+now.m, oncolor); setbgcolor('sec'+now.s, oncolor); } function resize(){ if(NS4)history.go(0); } function setbgcolor(idstr, color){ if(IE4)document.all[idstr].style.backgroundColor=color; if(NS4)document.layers[idstr].bgColor=color; if(NS6)document.getElementById(idstr).style.backgroundColor=color; } window.onload=init; window.onresize=resize; %26lt;/SCRIPT%26gt;