<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>无标题页</title> <SCRIPT> function show(){ var date = new Date(); //日期对象 var now = ""; now = date.getFullYear()+"年"; //读英文就行了 if( (date.getMonth()+1) < 10 ) now = now + "0"; now = now + (date.getMonth()+1)+"月"; if( date.getDate() < 10 ) now = now + "0"; now = now + date.getDate()+"日"; now = now + " 星期"; switch( date.getDay() ){ case 0 : now = now + "日"; break; case 1 : now = now + "一"; break; case 2 : now = now + "二"; break; case 3 : now = now + "三"; break; case 4 : now = now + "四"; break; case 5 : now = now + "五"; break; case 6 : now = now + "六"; break; } now = now + " "; if( date.getHours() < 12 ) now = now + "上午 "; else now = now + "下午 "; if( date.getHours() < 10 ) now = now + "0"; now = now + date.getHours()+":"; if( date.getMinutes() < 10 ) now = now + "0"; now = now + date.getMinutes()+":"; if( date.getSeconds() < 10 ) now = now + "0"; now = now + date.getSeconds(); document.getElementById("nowSpan").innerHTML = now; //div的html是now这个字符串 setTimeout("show()",1000); //设置过1000毫秒就是1秒,调用show方法 } </SCRIPT> </head> <body onload=show();> <SPAN id=nowSpan></SPAN> </body> </html>