<html>
<head>
<meta http-equiv='Content-Language' content='zh-cn'>
<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
</head>
<script language="JavaScript1.2">
//取年月份的天数,方法1
function GetDays(Year,Month)
{
d = new Date(Year,Month,0);
var Days = d.getDate();
removevalue(frm1.day);
addvalue(frm1.day,Days)
}
//取年月份的天数,方法2
function GetDays0(Year,Month)
{
var Days;
switch(Month)
{
case '1':
Days = 31;
break;
case '2':
if (Year%400 == 0 || (Year%4 == 0 && Year%100 != 0))
Days = 29;
else
Days = 28;
break;
case '3':
Days = 31;
break;
case '4':
Days = 30;
break;
case '5':
Days = 31;
break;
case '6':
Days = 30;
break;
case '7':
Days = 31;
break;
case '8':
Days = 31;
break;
case '9':
Days = 30;
break;
case '10':
Days = 31;
break;
case '11':
Days = 30;
break;
case '12':
Days = 31;
break;
default:
Days = 0;
break;
}
removevalue(frm1.day);
addvalue(frm1.day,Days)
}
function removevalue(sel)
{
var i,len;
len = sel.length - 1;
for (i = len;i >= 0;i--)
sel.remove(i);
}
function addvalue(obj,days)
{
for (i = 1;i <= days;i++)
{
obj.options[obj.length] = new Option(i,i);
}
}
</script>
<body bgcolor="#FFFFFF">
<form name=frm1 method="post">
<table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#E3EBF0">
<tr>
<td colspan=4 align="left">日期
<select name="year" οnchange="GetDays(this.value,frm1.month.value);">
<option value='2000'>2000</option>
<option value='2001'>2001</option>
<option value='2002'>2002</option>
<option value='2003'>2003</option>
<option value='2004'>2004</option>
<option value='2005'>2005</option>
<option value='2006'>2006</option>
<option value='2007' selected>2007</option>
</select>年
<select name="month" οnchange="GetDays0(frm1.year.value,this.value);">
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
<option value='5'>5</option>
<option value='6'>6</option>
<option value='7'>7</option>
<option value='8'>8</option>
<option value='9'>9</option>
<option value='10'>10</option>
<option value='11'>11</option>
<option value='12' selected>12</option>
</select>月
<select name="day">
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
<option value='5'>5</option>
<option value='6'>6</option>
<option value='7'>7</option>
<option value='8'>8</option>
<option value='9'>9</option>
<option value='10'>10</option>
<option value='11'>11</option>
<option value='12'>12</option>
<option value='13'>13</option>
<option value='14'>14</option>
<option value='15'>15</option>
<option value='16'>16</option>
<option value='17' selected>17</option>
<option value='18'>18</option>
<option value='19'>19</option>
<option value='20'>20</option>
<option value='21'>21</option>
<option value='22'>22</option>
<option value='23'>23</option>
<option value='24'>24</option>
<option value='25'>25</option>
<option value='26'>26</option>
<option value='27'>27</option>
<option value='28'>28</option>
<option value='29'>29</option>
<option value='30'>30</option>
<option value='31'>31</option>
</select>日
</td>
</tr>
</table>
</form>
</body>
</html>