当前位置:首页 > 程序源码 > 网页显示中文日期的JavaScript代码

网页显示中文日期的JavaScript代码

作者:不详来源:网络2007-07-10 15:12:28
网页显示中文日期的JavaScript代码

    将以下代码加入HEML的<body></body>之间:

 

<script LANGUAGE="JavaScript">
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-10)))}
else if(index1 < 30 ){
document.write("二十"+numberstring.substring(0+(index1-21),(index1-20)))}
else{
document.write("三十"+numberstring.substring(0+(index1-31),(index1-30)))}
}
var today1 = new Date()
var month = today1.getMonth()+1
var date = today1.getDate()
var day = today1.getDay()
document.write("<br><strong><small><center>")
document.write("公元二零零零年")
number(month)
document.write("月")
number(date)
document.write("日</small><center>")
</script>

© 2001-2020 www.DreamArt.cn All Rights Reserved.

点击这里给我发消息 电子邮件联系我们

吉ICP备16008406号-2   吉公网安备22012202000040号