JavaScript code:
<script type= "Text/javascript" > Function doyear () {var select = document.getElementById ("year");
var thisyear = new Date (). getFullYear ();
for (Var i=1900;i<=thisyear;i++) {var option = document.createelement ("option");
Option.value = i;
Option.innertext = i;
Select.appendchild (option);
The function Domoth () {var select = document.getElementById ("month");
for (Var i=1;i<=12;i++) {var option = document.createelement ("option");
Option.value = i;
Option.innertext = i;
Select.appendchild (option);
The function Doday () {var select = document.getElementById ("Day");
var selectyear = parseint (Year.options[year.selectedindex].value);
var selectmonth = parseint (Month.options[month.selectedindex].value);
var date = new Date (selectyear,selectmonth,0);
For (var i=1;i<=date.getdate (); i++) {var option = document.createelement ("option");
Option.value = i;
Option.innertext = i;
Select.appendchild (option); }} Function Deleteoldchildnodes () {var day = document.getElementById (' Day ');
var node=day.firstchild;
var Tmpnode;
while (node!=day.lastchild) {tmpnode = node.nextsibling;
Day.removechild (node);
node = Tmpnode;
} day.removechild (Day.lastchild);
function Pageinit () {doyear ();
Domoth ();
Doday ();
Year.onchange = function () {deleteoldchildnodes ();d oday ();
Month.onchange = function () {deleteoldchildnodes ();d oday (); } </script>
HTML page Code slice:
<body style= "Text-align:center" onload= "Pageinit ()" >
<table width= "70%" frame= "Border" >
<tr >
<td> birthday </td>
<td>
<select name= "year" id= "Years
" ></select> <select name= "Month" id= "month" ></select> month
<select name= "Day" id= "Days
" ></select> </td>
</tr>
</table>
</body>