﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-guoyaxu-文章分类-javascript</title><link>http://www.blogjava.net/guoyaxu/category/20282.html</link><description /><language>zh-cn</language><lastBuildDate>Sat, 07 Apr 2007 17:09:00 GMT</lastBuildDate><pubDate>Sat, 07 Apr 2007 17:09:00 GMT</pubDate><ttl>60</ttl><item><title>javascript 日期</title><link>http://www.blogjava.net/guoyaxu/articles/101441.html</link><dc:creator>江海鱼</dc:creator><author>江海鱼</author><pubDate>Fri, 02 Mar 2007 04:12:00 GMT</pubDate><guid>http://www.blogjava.net/guoyaxu/articles/101441.html</guid><wfw:comment>http://www.blogjava.net/guoyaxu/comments/101441.html</wfw:comment><comments>http://www.blogjava.net/guoyaxu/articles/101441.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/guoyaxu/comments/commentRss/101441.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/guoyaxu/services/trackbacks/101441.html</trackback:ping><description><![CDATA[
		<p> </p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #0000ff">function</span>
				<span style="COLOR: #000000"> leapYear(year)<br /><img id="Codehighlighter1_24_125_Open_Image" onclick="this.style.display='none'; Codehighlighter1_24_125_Open_Text.style.display='none'; Codehighlighter1_24_125_Closed_Image.style.display='inline'; Codehighlighter1_24_125_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_24_125_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_24_125_Closed_Text.style.display='none'; Codehighlighter1_24_125_Open_Image.style.display='inline'; Codehighlighter1_24_125_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_24_125_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.blogjava.net/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_24_125_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000"> (year </span>
						<span style="COLOR: #000000">%</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">400</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">==</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">) </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">true</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000"> (year </span>
						<span style="COLOR: #000000">%</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">4</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">==</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">&amp;&amp;</span>
						<span style="COLOR: #000000"> year </span>
						<span style="COLOR: #000000">%</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">100</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">!=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">) </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">true</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">false</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">function</span>
				<span style="COLOR: #000000"> validDate(year, month, date)<br /><img id="Codehighlighter1_166_566_Open_Image" onclick="this.style.display='none'; Codehighlighter1_166_566_Open_Text.style.display='none'; Codehighlighter1_166_566_Closed_Image.style.display='inline'; Codehighlighter1_166_566_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_166_566_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_166_566_Closed_Text.style.display='none'; Codehighlighter1_166_566_Open_Image.style.display='inline'; Codehighlighter1_166_566_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_166_566_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.blogjava.net/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_166_566_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />year </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> parseInt(year);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />month </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> parseInt(month);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />date </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> parseInt(date);<br /><img id="Codehighlighter1_287_303_Open_Image" onclick="this.style.display='none'; Codehighlighter1_287_303_Open_Text.style.display='none'; Codehighlighter1_287_303_Closed_Image.style.display='inline'; Codehighlighter1_287_303_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_287_303_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_287_303_Closed_Text.style.display='none'; Codehighlighter1_287_303_Open_Image.style.display='inline'; Codehighlighter1_287_303_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /></span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000"> (isNaN(year) </span>
						<span style="COLOR: #000000">||</span>
						<span style="COLOR: #000000"> isNaN(month) </span>
						<span style="COLOR: #000000">||</span>
						<span style="COLOR: #000000"> isNaN(date)) </span>
						<span id="Codehighlighter1_287_303_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_287_303_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span>
								<span style="COLOR: #0000ff">return</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">false</span>
								<span style="COLOR: #000000">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />}</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img id="Codehighlighter1_371_387_Open_Image" onclick="this.style.display='none'; Codehighlighter1_371_387_Open_Text.style.display='none'; Codehighlighter1_371_387_Closed_Image.style.display='inline'; Codehighlighter1_371_387_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_371_387_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_371_387_Closed_Text.style.display='none'; Codehighlighter1_371_387_Open_Image.style.display='inline'; Codehighlighter1_371_387_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />
						</span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000"> (year </span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">||</span>
						<span style="COLOR: #000000"> month </span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">||</span>
						<span style="COLOR: #000000"> month </span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">12</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">||</span>
						<span style="COLOR: #000000"> date </span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">||</span>
						<span style="COLOR: #000000"> date </span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">31</span>
						<span style="COLOR: #000000">) </span>
						<span id="Codehighlighter1_371_387_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_371_387_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span>
								<span style="COLOR: #0000ff">return</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">false</span>
								<span style="COLOR: #000000">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />}</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />
								<br />
								<img id="Codehighlighter1_420_445_Open_Image" onclick="this.style.display='none'; Codehighlighter1_420_445_Open_Text.style.display='none'; Codehighlighter1_420_445_Closed_Image.style.display='inline'; Codehighlighter1_420_445_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_420_445_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_420_445_Closed_Text.style.display='none'; Codehighlighter1_420_445_Open_Image.style.display='inline'; Codehighlighter1_420_445_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />
						</span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000"> (month </span>
						<span style="COLOR: #000000">==</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">2</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">&amp;&amp;</span>
						<span style="COLOR: #000000"> date </span>
						<span style="COLOR: #000000">==</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">29</span>
						<span style="COLOR: #000000">) </span>
						<span id="Codehighlighter1_420_445_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_420_445_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span>
								<span style="COLOR: #0000ff">return</span>
								<span style="COLOR: #000000"> leapYear(year);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />}</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img id="Codehighlighter1_506_529_Open_Image" onclick="this.style.display='none'; Codehighlighter1_506_529_Open_Text.style.display='none'; Codehighlighter1_506_529_Closed_Image.style.display='inline'; Codehighlighter1_506_529_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_506_529_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_506_529_Closed_Text.style.display='none'; Codehighlighter1_506_529_Open_Image.style.display='inline'; Codehighlighter1_506_529_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />
						</span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000"> (month </span>
						<span style="COLOR: #000000">==</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">4</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">||</span>
						<span style="COLOR: #000000"> month </span>
						<span style="COLOR: #000000">==</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">6</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">||</span>
						<span style="COLOR: #000000"> month </span>
						<span style="COLOR: #000000">==</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">9</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">||</span>
						<span style="COLOR: #000000"> month </span>
						<span style="COLOR: #000000">==</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">11</span>
						<span style="COLOR: #000000">) </span>
						<span id="Codehighlighter1_506_529_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_506_529_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span>
								<span style="COLOR: #0000ff">return</span>
								<span style="COLOR: #000000"> (date </span>
								<span style="COLOR: #000000">&lt;=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">30</span>
								<span style="COLOR: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />}</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />
						</span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> (month </span>
						<span style="COLOR: #000000">!=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">2</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">||</span>
						<span style="COLOR: #000000"> date </span>
						<span style="COLOR: #000000">&lt;=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">28</span>
						<span style="COLOR: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
		</div>
<img src ="http://www.blogjava.net/guoyaxu/aggbug/101441.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/guoyaxu/" target="_blank">江海鱼</a> 2007-03-02 12:12 <a href="http://www.blogjava.net/guoyaxu/articles/101441.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>