这个js语句如何让他在网页里自动刷新
vartime,year,month,day,hour,minute,second;vartoday=newDate();month=today.getMonth()+1...
var time,year,month,day,hour,minute,second;
var today=new Date();
month=today.getMonth()+1;
day=today.getDay();
var s=today.getFullYear()+"年"+month+"月"+today.getDate()+"日"+today.getHours()+"时"+today.getMinutes()+"分"+today.getSeconds()+"秒"+"\t";
document.write(s);
switch(day){
case 1:document.write("星期一");break;
case 2:document.write("星期二");break;
case 3:document.write("星期三");break;
case 4:document.write("星期四");break;
case 5:document.write("星期五");break;
case 6:document.write("星期六");break;
case 7:document.write("星期日");break;
} 展开
var today=new Date();
month=today.getMonth()+1;
day=today.getDay();
var s=today.getFullYear()+"年"+month+"月"+today.getDate()+"日"+today.getHours()+"时"+today.getMinutes()+"分"+today.getSeconds()+"秒"+"\t";
document.write(s);
switch(day){
case 1:document.write("星期一");break;
case 2:document.write("星期二");break;
case 3:document.write("星期三");break;
case 4:document.write("星期四");break;
case 5:document.write("星期五");break;
case 6:document.write("星期六");break;
case 7:document.write("星期日");break;
} 展开
1个回答
展开全部
<div id=now></div>
<script>
setInterval(function(){
var td=new Date();
var s=td.getFullYear()+"年";
s+=(td.getMonth()+1)+"月";
s+=td.getDate()+"日";
s+=td.getHours()+"时";
s+=td.getMinutes()+"分";
s+=td.getSeconds()+"秒 星期";
s+=["日","一","二","三","四","五","六"][td.getDay()];
now.innerHTML=s;
},1000);
</script>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询