Hi,

I want to create a simple form where the user inputs their birthdate. There are three drop downs. One for month, one for day and for year. I would like to do it with js and arrays and not have to list all the options for days and years. I found examples for how to do the months. (see below)

What I want to know is how do I create an array for the days and years without having to list them out? It seems like there should be a way to define an array to start with one and end with 31? or 1900 - 2000? Any advice, guidance will be greatly appreciated. I see many birthdate input fields forms are they done manually?


<script language="javascript" >

function addOption(selectbox,text,value )
{
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
}


function addOption_list(selectbox){

var month = new Array("January","February","March","April","May","June","July","August","September","October","Novem ber","December");
for (var i=0; i < month.length;++i){


addOption(document.drop_list.Month_list, month[i], month[i]);
}
}
</script>

<body onLoad="addOption_list()";>

<FORM name="drop_list" action="" method="POST" >

<SELECT NAME="Month_list">
<Option value="" >Month list</option>
</SELECT>
</form>

The example came from here: http://www.plus2net.com/javascript_t...ist-adding.php

Cheers,
Techie35