日期:2014-05-16 浏览次数:20501 次
<div class="date"><script language="javascript"><!-- var today = new Date(); var week; var date; if(today.getDay()==0) week="星期日"; if(today.getDay()==1) week=" 星期一"; if(today.getDay()==2) week="星期二"; if(today.getDay()==3) week=" 星期三"; if(today.getDay()==4) week="星期四"; if(today.getDay()==5) week=" 星期五"; if(today.getDay()==6) week="星期六"; date= (today.getYear())+"年"+(today.getMonth()+1)+"月"+today.getDate()+"日"+" "; document.write(date+week); // --> </script>
<head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>兼容FireFox的当前时间的JS脚本</title> </head> <body> <DIV id=time>当前时间 <SCRIPT>document.getElementById('time').innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());setInterval("document.getElementById('time').innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());",1000);</SCRIPT> </DIV> </body> </html>