DreamAngel
如果你希望成功,以恒心為良友,以經驗為參謀,以小心為兄弟,以希望為哨兵。
BlogJava
首頁
新隨筆
聯系
聚合
管理
隨筆 - 147 文章 - 71 trackbacks - 0
<
2009年4月
>
日
一
二
三
四
五
六
29
30
31
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
27
28
29
30
1
2
3
4
5
6
7
8
9
我的其它Blog:
www.cppblog.com/dreamangel/
blog.csdn.net/fjnu_angel/
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(1)
給我留言
查看公開留言
查看私人留言
隨筆分類
(146)
ACM(28)
ajax(9)
eclipse(3)
Game(6)
Hibernate(1)
java(20)
javascript(19)
jfreechart(3)
jfreereport(1)
JSP(16)
linux(4)
log4j(3)
Spring(1)
SQL(7)
Struts(3)
Tomcat(3)
其它(12)
正則表達式(3)
網絡管理(2)
軟件設計(2)
隨筆檔案
(147)
2015年4月 (1)
2013年9月 (2)
2013年8月 (1)
2013年3月 (1)
2012年8月 (2)
2012年7月 (1)
2012年6月 (1)
2012年5月 (2)
2012年3月 (2)
2012年2月 (1)
2012年1月 (2)
2011年12月 (3)
2011年11月 (6)
2011年10月 (6)
2011年9月 (1)
2010年5月 (1)
2010年4月 (1)
2010年1月 (1)
2009年12月 (3)
2009年11月 (7)
2009年10月 (7)
2009年9月 (9)
2009年8月 (6)
2009年7月 (17)
2009年6月 (8)
2009年5月 (8)
2009年4月 (4)
2009年3月 (17)
2009年2月 (16)
2009年1月 (10)
文章分類
(28)
foj(3)
poj(15)
spoj(9)
zoj(1)
文章檔案
(28)
2010年9月 (2)
2010年7月 (1)
2009年9月 (14)
2009年8月 (11)
喜歡的Blog
BeanSoft
fuhoujun
yoyo
不朽的飛翔
樂在其中
宇天
我和hacker有個約會
銀河使者
阿蜜果
搜索
最新評論
1.?re: MyEclipse6.5 注冊碼生成方法,自己輸入用戶名[未登錄]
5656
--lk
2.?re: MyEclipse6.5 注冊碼生成方法,自己輸入用戶名
henhaoyong
--wuxiaoming
3.?re: MyEclipse6.5 注冊碼生成方法,自己輸入用戶名
wuxiaoming
--wuxiaoming
4.?re: js獲得table單元格的信息
颯沓
--阿爾
5.?re: log4j:ERROR Failed to rename錯誤解決辦法[未登錄]
謝謝樓主,問題解決!
--bobo
閱讀排行榜
1.?用戶權限管理設計(33603)
2.?關于路由器設置DI-504的401 Unauthorized authorization required(19095)
3.?ubuntu下gcc的安裝與使用(18765)
4.?Proguard使用教程(12621)
5.?ExtJS的tbar布局(10596)
評論排行榜
1.?MyEclipse6.5 注冊碼生成方法,自己輸入用戶名(14)
2.?用戶權限管理設計(9)
3.?OA系統權限管理設計方案(7)
4.?判斷一個月有多少天(正確的方法)(4)
5.?泰訊軟件數據庫筆試題目(SQL Server 2000版)(3)
javascript實現日期星期的顯示
Javascript實現日期星期全顯示,項目的需要顯示日期和星期,下面代碼就可以顯示當前的日期和星期
<
html
>
<
body
>
<
script
language
=javascript
>
<!--
todayDate
=
new
Date();
date
=
todayDate.getDate();
month
=
todayDate.getMonth()
+
1
;
year
=
todayDate.getYear();
document.write(
"
今天是
"
)
document.write(
"
<br>
"
)
if
(navigator.appName
==
"
Netscape
"
)
{
document.write(
1900
+
year);
document.write(
"
年
"
);
document.write(month);
document.write(
"
月
"
);
document.write(date);
document.write(
"
日
"
);
document.write(
"
<br>
"
)
}
if
(navigator.appVersion.indexOf(
"
MSIE
"
)
!=
-
1
)
{
document.write(year);
document.write(
"
年
"
);
document.write(month);
document.write(
"
月
"
);
document.write(date);
document.write(
"
日
"
);
document.write(
"
<br>
"
)
}
if
(todayDate.getDay()
==
5
) document.write(
"
星期五
"
)
if
(todayDate.getDay()
==
6
) document.write(
"
星期六
"
)
if
(todayDate.getDay()
==
0
) document.write(
"
星期日
"
)
if
(todayDate.getDay()
==
1
) document.write(
"
星期一
"
)
if
(todayDate.getDay()
==
2
) document.write(
"
星期二
"
)
if
(todayDate.getDay()
==
3
) document.write(
"
星期三
"
)
if
(todayDate.getDay()
==
4
) document.write(
"
星期四
"
)
//
-->
</
script
>
</
body
>
</
html
>
todayDate = new Date();
當定義一個新的對象時,通常使用“new”操作符。在這里,就是創建了日期對象。
date = todayDate.getDate();
getDate()是Date對象的一種方法,其功能是獲得當前的日期。
month= todayDate.getMonth() + 1 ;
getMonth()是Date對象的一種方法,其功能是獲得當前的日期,由于月份是從0開始的,所以這里要“+1”。
year= todayDate.getYear()
getYear()是Date對象的一種方法,其功能是獲得當前的年份。
if(navigator.appName == "Netscape") { document.write(1900+year); document.write("年"); document.write(month); document.write("月"); document.write(date); document.write("日");
document.write("<br> ") }
如果瀏覽器是Netscape,輸出今天是“year”+“年”+“month”+“月”+“date”+“日”,其中年要加1900。
if(navigator.appVersion.indexOf("MSIE") != -1) { document.write(year); document.write("年"); document.write(month); document.write("月"); document.write(date); document.write("日");
document.write("<br> ") }
如果瀏覽器是IE,直接輸出今天是“year”+“年”+“month”+“月”+“date”+“日”。
if (todayDate.getDay() == 5) document.write("星期五");
if (todayDate.getDay() == 6) document.write("星期六");
if (todayDate.getDay() == 0) document.write("星期日");
if (todayDate.getDay() == 1) document.write("星期一");
if (todayDate.getDay() == 2) document.write("星期二");
if (todayDate.getDay() == 3) document.write("星期三");
if (todayDate.getDay() == 4) document.write("星期四")
getDay()是Date對象的一種方法,其功能是獲得當前是星期幾。document.write輸出今天是“星期幾”。
posted on 2009-04-06 10:45
飛翔天使
閱讀(2216)
評論(3)
編輯
收藏
所屬分類:
javascript
FeedBack:
#
re: javascript實現日期星期的顯示 2009-04-07 09:06
haix
不錯,支持
firefox那
回復
更多評論
#
re: javascript實現日期星期的顯示 2010-01-21 10:56
黑葉拜天
新手!學習啦~
謝謝呀
回復
更多評論
#
re: javascript實現日期星期的顯示
2014-05-27 15:18
ii
if (todayDate.getDay() == 5) document.write("星期五");
if (todayDate.getDay() == 6) document.write("星期六");
if (todayDate.getDay() == 0) document.write("星期日");
if (todayDate.getDay() == 1) document.write("星期一");
if (todayDate.getDay() == 2) document.write("星期二");
if (todayDate.getDay() == 3) document.write("星期三");
if (todayDate.getDay() == 4) document.write("星期四")
回復
更多評論
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關文章:
Javascript+CSS實現Flash動態新聞效果
網頁的復制和防復制
js獲得table單元格的信息
圖片上傳的綜合操作
單擊放回上頁的按鈕或使用window.history.go(-1)返回上頁的同時刷新"上頁"技術
模態窗口window.showModalDialog
三種彈出對話框的用法實例
window.open教程
js常用技巧(2012.7.16更新)
javascript實現日期星期的顯示
Copyright ©2025 飛翔天使 Powered by:
博客園
模板提供:
滬江博客
主站蜘蛛池模板:
国产成人麻豆亚洲综合无码精品
|
a级大片免费观看
|
性色av无码免费一区二区三区
|
亚洲av永久无码精品漫画
|
亚洲国产精品线观看不卡
|
男女作爱在线播放免费网站
|
国产偷国产偷亚洲高清日韩
|
xxxxx做受大片在线观看免费
|
免费一级黄色毛片
|
永久免费无码日韩视频
|
久久亚洲中文字幕精品一区
|
中文字幕成人免费高清在线
|
久久精品国产亚洲av麻豆
|
久久免费精彩视频
|
亚洲欧洲国产精品久久
|
a毛片基地免费全部视频
|
亚洲欧美精品午睡沙发
|
成人永久免费高清
|
美女裸免费观看网站
|
免费一级一片一毛片
|
一级一看免费完整版毛片
|
亚洲福利中文字幕在线网址
|
福利片免费一区二区三区
|
亚洲AV无码一区二三区
|
午夜免费不卡毛片完整版
|
亚洲午夜无码毛片av久久京东热
|
日韩免费高清视频
|
精品人妻系列无码人妻免费视频
|
亚洲∧v久久久无码精品
|
精品久久久久成人码免费动漫
|
亚洲精品V天堂中文字幕
|
亚洲综合亚洲综合网成人
|
日本免费A级毛一片
|
一本天堂ⅴ无码亚洲道久久
|
亚洲国产精品人人做人人爱
|
暖暖免费日本在线中文
|
亚洲风情亚Aⅴ在线发布
|
亚洲最大AV网站在线观看
|
亚洲一级毛片免费在线观看
|
国产午夜亚洲精品不卡免下载
|
亚洲av伊人久久综合密臀性色
|