代码:
<script language="JavaScript" type="text/javascript">
<!--
function show(s){
if(s==2){
if(document.fo.day.length>28){
var year=document.fo.year.value;
if(year%4==0||year%100==0){
document.fo.day.options.remove(30);
document.fo.day.options.remove(29);
}
else{
document.fo.day.options.remove(30);
document.fo.day.options.remove(29);
document.fo.day.options.remove(28);
}
}
}
else if(s==4||s==6||s==9||s==11){
if(document.fo.day.length>29){
document.fo.day.options.remove(30);
}
else{
var i=document.fo.day.length+1;
for(var m=i;m<31;m++){
document.fo.day.options[document.fo.day.length] = new Option(m,m);
}
}
}
else{
if(document.fo.day.length<=30){
var i=document.fo.day.length+1;
for(var m=i;m<32;m++){
document.fo.day.options[document.fo.day.length] = new Option(m,m);
}
}
}
}
-->
</script>
<html>
<body>
<form name="fo">
<select name="year" id="year">
<option value="2000">2000</option>
<option value="1996">1996</option>
<option value="2163">2163</option>
</select>
<select name="month" id="month" onChange="show(this.options[this.options.selectedIndex].value)">
<option value="1">01</option>
<option value="2">02</option>
<option value="3">03</option>
<option value="4">04</option>
<option value="5">05</option>
<option value="6">06</option>
<option value="7">07</option>
<option value="8">08</option>
<option value="9">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
<select name="day" id="day">
<option value="1">01</option>
<option value="2">02</option>
<option value="3">03</option>
<option value="4">04</option>
<option value="5">05</option>
<option value="6">06</option>
<option value="7">07</option>
<option value="8">08</option>
<option value="9">09</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">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>
</form>
</body>
</html>
<option>可以用循环生成.上面的脚本的写法总觉得不是很好.大家可以指点一下.