<script language="JavaScript1.2" > RStimeFormat = "%h:%m:%s %a"; function RS_getTimeString(format) { ptr = format.indexOf("%"); old = 0; time=""; while(ptr != -1) { ch = format.charAt(ptr+1); time += format.substring(old,ptr) + RS_getFormat(ch); old = ptr+2; ptr = format.indexOf("%",old); } time += format.substring(old,format.length); return time; } function RS_setDigits(num, howmany) { str = num.toString(); if (str.length >= howmany) return str; for (i = str.length; i < howmany; i++) str = "0" + str; return str; } function RS_getFormat(ch) { now = new Date(); if(ch=='h') { hour = now.getHours(); if(hour == 0) { hour = 12; } else if (hour > 12) { hour -= 12; } return hour; } else if(ch=='H') { return now.getHours(); } else if(ch=='m') { return RS_setDigits(now.getMinutes(),2); } else if(ch=='s') { return RS_setDigits(now.getSeconds(),2); } else if(ch=='d') { return now.getDate(); } else if(ch=='D') { return monArray[now.getMonth()]; } else if(ch=='y') { return ((now.getYear() <= 99) ? now.getYear() : RS_setDigits(now.getYear()-2000,2));} else if(ch=='Y') { return ((now.getYear() <= 99) ? "19"+now.getYear() : now.getYear());} else if(ch=='a') { if(now.getHours() == 0 || now.getHours() > 11) return "PM"; else return "AM"; } else return ""; } function RS_changeText(id, str) { if(document.layers) { // if Navigator 4.0+ with(document[id].document) { open(); write(str); close(); } } else { // Internet Explorer 4.0+ document.all[id].innerHTML = str; } }
function RS_startClock() { ClockID = setInterval("RS_changeText('RStimeLayer',RS_getTimeString(RStimeFormat))",500) }
if(document.all||document.layers) RS_startClock(); </script> <div id=RStimeLayer><a href=http://www.letgo.com.cn target=_blank>网页特效</a></div> 本代码由<a href=http://www.letgo.com.cn>号主机</a>提供 |
|