i have a list for choosing years in drop down, how can generate list dynamically.
my code :
<select id="year1">
<option value=2012>2012</option>
<option value=2011>2011</option>
<option value=2010>2010</option>
</select>
i have written a script like this,
for(i = 0; i < 6; i++)
{
document.getElementById('year1').options[i] = new Option(curr_year-i+1,curr_year-i+1);
}
my doubt is how can give values here,( i.e < option value= "2012">2012 ) dynamically. thanks in advance. note: for me taking value in the option is important.