var isnMonth = new
Array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");
var isnDay = new
Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六","星期日");
today = new Date () ;
Year=today.getYear();
Date=today.getDate();
if (document.all)
document.title="今天是: "+Year+"年"+isnMonth[today.getMonth()]+Date+"日"+isnDay
</script>
二、状态栏显示日期、时间:
function doClock()
{
window.setTimeout( "doClock()", 1000);
today = new Date();
self.status = today.toString();
}
doClock()
</script>
三、全中文日期:
function number(index1)
{
var numberstring="一二三四五六七八九十";
if(index1 ==0) {document.write("十")}
if(index1 < 10){document.write(numberstring.substring(0+(index1-1),index1))}
else if(index1 < 20 ){document.write("十"+numberstring.substring(0+(index1-11),(index1-
else if(index1 < 30 ){document.write("二十"+numberstring.substring(0+(index1-21),(index1-
else{document.write("三十"+numberstring.substring(0+(index1-31),(index1-30)))}
}
var month = today1.getMonth()+1
var date = today1.getDate()
var day = today1.getDay()
number(month)
document.write("月")
number(date)
document.write("日")
</script>
欲看各代码的效果,可以把代码拿到我的代码测试器里测试:http://blog.sina.com.cn/u/4723cdbf010005qb,测试时请先“清空代码”,然后把代码复制到代码测试器中,记住要去掉代码最前面的 <script>,否则测试不出来,接着点“运行代码”就可以看到效果了。但是把代码用在博客上的时候 <script>不能删,要留着。
代码一旦放在空白面板里就别去动它,因为新浪会屏蔽<script>,所以我们使用JS代码都要在代码前多加个<script>,而且不能放在什么东西都没的空白面板里。代码保存过一次后再次打开红色的<script>就没了,再次保存的话要重新加上个<script>,因此一般第一次保存后最好别去动它!