document.write("<span id=time></span>") //输出显示时间日期的容器 
setInterval(function(){ 
with(new Date) 
time.innerText=getYear()+"年"+(getMonth()+1)+"月"+getDate()+"日 星期"+"日一二三四五六".charAt(getDay())+" "+getHours()+":"+getMinutes()+":"+getSeconds() 
//设置 id 为 time 的对象内的文本为当前日期时间 
},1000)       //每1000毫秒(即1秒) 执行一次本段代码 
