控制項 displayCalendar(obj_month.innerText-1,obj_year.innerText);
}
function numberOfDays(month,year) //取得每月天數,判斷平年閏年
{
var numDays=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
n=numDays[month];
if(month==1&&year%4==0) ++n;
return n;
}
function displayCalendar(month,year)
{
var d=new Date(year,month,1);
var startDay=d.getDay(); //日期起始數字
var numDays=numberOfDays(month,year); //本月天數
var day=document.getElementsByName("day");
for(var i=0;i<day.length;i++)
{
day[i].innerText="";
}
for(var j=1;j<=numDays;j++) //插入日期
{
day[startDay+j-1].innerText=j;
}
}
function writeDate(n)
{
document.writeln("<H3 ALIGN='CENTER'>"+n+"</H3>");
}
function add_day(year,month,day)
{
bd.birthdate.value=year+"-"+month+"-"+day;
}
</script>
</HEAD>
<BODY>
<form name="bd">
<input type="text" name="birthdate" size="20" readOnly><input type="button" value="..." >
</form>
<div id="input_birth" name="input_birth" style="visibility:hidden; width:239; height:128">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" style="cursor:hand" bordercolor="#111111" width="100%" height="26">
<tr>