您的位置:首页 > Web前端 > JavaScript

JSP页面显示时间 2015年9月11日 星期五

2015-10-18 00:00 651 查看


在Jsp页面的<javascript>中粘贴这段代码即可

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26
tmpDate =

new

Date();


date = tmpDate.getDate();


month= tmpDate.getMonth() + 1 ;


year= tmpDate.getFullYear();


document.write(year);


document.write(

"年"

);


document.write(month);


document.write(

"月"

);


document.write(date);


document.write(

"日 "

);


myArray=

new

Array(6);


myArray[0]=

"星期日"


myArray[1]=

"星期一"


myArray[2]=

"星期二"


myArray[3]=

"星期三"


myArray[4]=

"星期四"


myArray[5]=

"星期五"


myArray[6]=

"星期六"


weekday=tmpDate.getDay();


if

(weekday==0 | weekday==6)


{


document.write(myArray[weekday])


}


else


{document.write(myArray[weekday])


};


来自为知笔记(Wiz)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: