Reputation: 29
Here I have a task that Years Should be Bind in DropdownList Like 1947 to 2016 if I write Code Like
<select>
<option value="1947">1947</option>
<option value="2016">2016</option>
</select>
Its Taken whole day
Upvotes: 1
Views: 52
Reputation: 6656
This could be done by javascript for example:
<select id="year"></select>
JScript:
var year = 1947;
var till = 2016;
var options = "";
for(var y=year; y<=till; y++){
options += "<option>"+ y +"</option>";
}
document.getElementById("year").innerHTML = options;
Upvotes: 3