<br />function showLocale(objD)<br />{<br /> var str,colorhead,colorfoot;<br /> var yy = objD.getYear();<br /> if(yy<1900) yy = yy+1900;<br /> var MM = objD.getMonth()+1;<br /> if(MM<10) MM = '0' + MM;<br /> var dd = objD.getDate();<br /> if(dd<10) dd = '0' + dd;<br /> var hh = objD.getHours();<br /> if(hh<10) hh = '0' + hh;<br /> var mm = objD.getMinutes();<br /> if(mm<10) mm = '0' + mm;<br /> var ss = objD.getSeconds();<br /> if(ss<10) ss = '0' + ss;<br /> var ww = objD.getDay();<br /> if ( ww==0 ) colorhead="<font color=\"#FF0000\">";<br /> if ( ww > 0 && ww < 6 ) colorhead="<font color=\"#373737\">";<br /> if ( ww==6 ) colorhead="<font color=\"#008000\">";<br /> if (ww==0) ww="星期日";<br /> if (ww==1) ww="星期一";<br /> if (ww==2) ww="星期二";<br /> if (ww==3) ww="星期三";<br /> if (ww==4) ww="星期四";<br /> if (ww==5) ww="星期五";<br /> if (ww==6) ww="星期六";<br /> colorfoot=""<br /> str = colorhead + yy + "-" + MM + "-" + dd + " " + hh + ":" + mm + ":" + ss + " " + ww + colorfoot;<br /> return(str);<br />}<br />function tick()<br />{<br /> var today;<br /> today = new Date();<br /> document.getElementById("localtime").innerHTML = showLocale(today);<br /> window.setTimeout("tick()", 1000);<br />}<br />tick();<br /> 程序员交流QQ群:290551701,感兴趣的朋友可以加一下。