<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script language="JavaScript" type="text/javascript">
var s_y,s_m,s_d;
function initSelectDate(){
var curDate=new Date();
s_y=document.getElementById("s_y");
s_m=document.getElementById("s_m");
s_d=document.getElementById("s_d");
for (var i=1970;i<2050;i++){
s_y.options.add(new Option(i,i))
}
for (var i=1;i<=12;i++){
s_m.options.add(new Option(i,i));
}
s_y.οnchange=function(){changeDate()};
s_y.value=curDate.getYear();
s_m.οnchange=function(){changeDate()};
s_m.value=curDate.getMonth()+1;
changeDate()
}
function changeDate(){
var t=s_d.value;
s_d.options.length=0;
var j=0;
switch(parseInt(s_m.value,10)){
case 4:
case 6:
case 9:
case 11:
j=30;
break;
case 2:
var y=s_y.value;
if (y%4==0&&y%100!=0||y%400==0)
j=29;
else
j=28;
break;
default:
j=31;
}
for (var i=1;i<=j;i++)
s_d.options.add(new Option(i,i));
if (t!=""){
if (t>j)
s_d.value=j;
else
s_d.value=t;
}
else
s_d.value=new Date().getDate();
}
</script>
<title>JS制作年月日下拉列表</title></head>
<body οnlοad="initSelectDate()">
<select id="s_y"></select>
<select id="s_m"></select>
<select id="s_d"></select>
</BODY>
</HTML>