Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript dropdown options auto-updating

<select name="year">
<option value="">-- Select Year --</option>
<script type="text/javascript"><!--
var HowManyListItems = 5; // Specify number of "year" selections.
var year = new Date().getFullYear();
for(var i = 0; i < HowManyListItems; i++)
{
   var t = i + year;
   document.write('<option value="' + t + '">' + t + '</option>');
}
//--></script>
</select>
Source by www.willmaster.com #
 
PREVIOUS NEXT
Tagged: #javascript #dropdown #options
ADD COMMENT
Topic
Name
3+8 =