///兼容ie6,7,8
<div class="menu_r" id="liveclock">//div嵌套日期,赋控件id值
//js源码
<script language="javascript">
function displaytime()
{
thisdate=new Date()
thismonth=thisdate.getMonth()
thismonth=thismonth+1
thisday=thisdate.getDate()
thisyear=thisdate.getYear()
thisweek=thisdate.getDay();switch(thisweek){case 0: thisweek="星期日"; break;case 1: thisweek="星期一"; break;case 2: thisweek="星期二"; break;case 3: thisweek="星期三"; break;case 4: thisweek="星期四"; break;case 5: thisweek="星期五"; break;case 6: thisweek="星期六"; break;
}
if (thisyear<2000)
{thisyear=thisyear+1900}
document.getElementById("liveclock").innerHTML=thisyear+"年"+thismonth+"月"+thisday+"日"+" "+thisweek+" ";}//获取div的id显示时间
displaytime();setInterval('displaytime()',1000); </script>
//js源码
</div>