1个回答
展开全部
这个如何呢?
<SPAN class="heise" id="liveclock"></SPAN><script language="javascript">
function timeprint()
{
var week; var date;
var today=new Date()
var year=today.getYear()
var month=today.getMonth()+1
var day=today.getDate()
var ss=today.getDay()
var hours=today.getHours()
var minutes=today.getMinutes()
var seconds=today.getSeconds()
date=year+"年"+month+"月"+day+"日 "
if(ss==0) week="星期日"
if(ss==1) week="星期一"
if(ss==2) week="星期二"
if(ss==3) week="星期三"
if(ss==4) week="星期四"
if(ss==5) week="星期五"
if(ss==6) week="星期六"
if(minutes<=9)
minutes="0"+minutes
if(seconds<=9)
seconds="0"+seconds
myclock=date+week+" "+hours+":"+minutes+":"+seconds
if(document.layers){document.layers.liveclock.document.write(myclock)
document.layers.liveclock.document.close()
}else if(document.all)
liveclock.innerHTML=myclock
setTimeout("timeprint()",1000)
}
timeprint();
//-->
</script>
<SPAN class="heise" id="liveclock"></SPAN><script language="javascript">
function timeprint()
{
var week; var date;
var today=new Date()
var year=today.getYear()
var month=today.getMonth()+1
var day=today.getDate()
var ss=today.getDay()
var hours=today.getHours()
var minutes=today.getMinutes()
var seconds=today.getSeconds()
date=year+"年"+month+"月"+day+"日 "
if(ss==0) week="星期日"
if(ss==1) week="星期一"
if(ss==2) week="星期二"
if(ss==3) week="星期三"
if(ss==4) week="星期四"
if(ss==5) week="星期五"
if(ss==6) week="星期六"
if(minutes<=9)
minutes="0"+minutes
if(seconds<=9)
seconds="0"+seconds
myclock=date+week+" "+hours+":"+minutes+":"+seconds
if(document.layers){document.layers.liveclock.document.write(myclock)
document.layers.liveclock.document.close()
}else if(document.all)
liveclock.innerHTML=myclock
setTimeout("timeprint()",1000)
}
timeprint();
//-->
</script>
追问
不行啊,你这个好像是java的啊
追答
晕 ,呢个是js 来的 !!!兼容性可能唔好 !
var week;
if(new Date().getDay()==0) week="星期日"
if(new Date().getDay()==1) week="星期一"
if(new Date().getDay()==2) week="星期二"
if(new Date().getDay()==3) week="星期三"
if(new Date().getDay()==4) week="星期四"
if(new Date().getDay()==5) week="星期五"
if(new Date().getDay()==6) week="星期六"
document.write("友情提示:今天是:"+(new Date().getMonth()+1)+"月"+new Date().getDate()+"日 "+week);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询