CSDN博客

img hyxs

JavaScript 显示当前日期

发表于2004/10/25 10:24:00  5992人阅读

分类: JSP/JavaScript/HTML...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script language="JavaScript">  
function showweek() // 显示中文星期
{now = new Date() //定义新对象,new具有Date的性质  
if (now.getDay() == 0) return ("星期一")  
if (now.getDay() == 1) return ("星期二")  
if (now.getDay() == 2) return ("星期三") 
if (now.getDay() == 3) return ("星期四") 
if (now.getDay() == 4) return ("星期五") 
if (now.getDay() == 5) return ("星期六")  
if (now.getDay() == 6) return ("星期日")  
}  

function showdate() //显示系统日期  
{  
var now = new Date()  
var year = now.getYear()  
var month = now.getMonth()+1  
var day = now.getDate()  
return year+"年"+month+"月"+day+"日"  
}  
</script>
</HEAD>

<BODY>
<script language="Javascript"> 
 document.write("今天的日期是:"+showdate()+""+showweek())  
</script>
</BODY>
</HTML>

 

阅读全文
0 0

相关文章推荐

img
取 消
img