例如下面代码:<script type="text/javascript"> window.onload= function w(){ function e(i){ if(i<10){ i="0"+i; }else{ return i;} } var time=new Date(); var year=time.getFullYear(); var month=time.getMonth()+1; var day=time.getDate(); var week=time.getDay() var weekday=new Array(); weekday[0]="星期日"; weekday[1]="星期一"; weekday[2]="星期二"; weekday[3]="星期三"; weekday[4]="星期四"; weekday[5]="星期五"; weekday[6]="星期六"; var h=time.getHours(); var m=time.getMinutes(); var s=time.getSeconds(); m=e(m); s=e(s); document.getElementById("first1").innerHTML=year+"年"+month+"月"+day+"日"+weekday[week]+h+":"+m+":"+s; setTimeout(w,500) } </script>
添加回答
举报
0/150
提交
取消