有需要的拷贝下面代码贴在公告里即可
<script language="javascript"> window.setInterval("fnRecycle()",1000); function fnRecycle(){ var oDate=new Date(); var sYear = oDate.getFullYear(); var sMonth = oDate.getMonth() + 1; var sDay = oDate.getDate(); var sWeekDay = oDate.getDay(); if(sWeekDay == 6) { tdDay.style.color = "red"; tdWeek.style.color = "red"; } else if(sWeekDay == 0) { tdDay.style.color = "#488E25"; tdWeek.style.color = "#488E25"; sWeekDay = 7; } else if(sWeekDay == 1) { tdDay.style.color = "gray"; tdWeek.style.color = "gray"; } else if(sWeekDay == 2) { tdDay.style.color = "gray"; tdWeek.style.color = "gray"; } else if(sWeekDay == 3) { tdDay.style.color = "gray"; tdWeek.style.color = "gray"; } else if(sWeekDay == 4) { tdDay.style.color = "gray"; tdWeek.style.color = "gray"; } else if(sWeekDay == 5) { tdDay.style.color = "gray"; tdWeek.style.color = "gray"; } tdWeek.innerHTML = sWeekDay; tdDate.innerHTML = sYear + "年" + sMonth + "月"; tdDay.innerHTML = sDay;
var sSwitch="上午"; var iHours=oDate.getHours(); if(iHours>=12 && iHours<18){ sSwitch="下午"; } else if(iHours>=0 && iHours<=6) { sSwitch="凌晨"; } else if(iHours>6 && iHours<12) { sSwitch="上午"; } else if(iHours>=18 && iHours<=23) { iHours-=12; sSwitch="晚上"; } var sMinutes=oDate.getMinutes() + ""; if(sMinutes.length==1){ sMinutes="0" + sMinutes; } var sSeconds=oDate.getSeconds() + ""; if(sSeconds.length==1){ sSeconds="0" + sSeconds; } tdTime.innerHTML=sSwitch + " " + iHours + ":" + sMinutes + ":" + sSeconds; } </script> <table style="BORDER-RIGHT: gray 1px dotted; BORDER-TOP: gray 1px dotted; BORDER-LEFT: gray 1px dotted; BORDER-BOTTOM: gray 1px dotted" cellSpacing="0" cellPadding="0" width="80%" align="center"> <tr><td colspan="2"> </td></tr> <tr> <td align="center" style="font-family:Georgia; font-size:12px; color:Black;" id="tdDate" colspan="2"></td> </tr> <tr > <td align="right" width="60%" style="font-family: Georgia; font-weight:bold; font-size:28px; color:gray;" id="tdDay" valign="top"></td> <td align="left" width="40%" style="font-family: Georgia; font-size:12px; color:Black;" id="tdWeek" valign="top"></td> </tr> <tr> <td align="center" style="font-family: Georgia; font-size:12px; color:Black;" id="tdTime" colspan="2"></td> </tr> <tr><td colspan="2"> </td></tr> </table> <script language="javascript"> fnRecycle(); </script> |