<script>
function populateDropdown()
{
var dropdown = document.getElementById("ddFAge");
for(var i=1;i<=100;i++)
{
var newOption = new Option()
newOption=document.createElement(option);
newOption.Text = i;
newOption.value = i;
dropdown.options[i] = newOption;
//dropdown.options.add(newOption);
//<option value="0"><--Select Age--></option>
}
}
window.onload=populateDropdown();
</script>
I designed this script to assign numbers 1-100 to an asp.net dropdown list. However, the dropdown list is not displaying any data. I have included a screenshot of the inactive dropdown. What mistake did I make in the code above?