|
|
類型:js_article Javascript中判斷潤年最最簡單的代碼實例網頁javascript測試函數issmoothyear() 1 <script language="javascript">
2 var issmoothyear = function(year) 3 { 4 return (new date(year , 2 , 0).getdate() == 29); 5 } 6 alert("2004年 是潤年嗎? \t" + issmoothyear(2004)); 7 alert("2005年 是潤年嗎? \t" + issmoothyear(2005)); 8 alert("2006年 是潤年嗎? \t" + issmoothyear(2006)); 9 alert("2007年 是潤年嗎? \t" + issmoothyear(2007)); 10 alert("2008年 是潤年嗎? \t" + issmoothyear(2008)); 11 </script> java代碼同理 1 import java.util.*; 2 3 class testdate 4 { 5 public static void main(string[] args) 6 { 7 date date = new date(2004 , 2 , 0); 8 systb.out.println(date.getdate()); 9 } 10} 11 |
|
104休閒信箱 2.3.0 © 104mm.com 2001 - 2021. | 您尚未登錄 |