Hello
i need some help here...i need a javascript to do a drop down list of months.
currently i hardcoded it in my program..
<select name="Mth" class="formlist">
<option></option>
<option value = "1">January</option>
<option value = "2">February</option>
<option value = "3">March</option>
<option value = "4">April</option>
<option value = "5">May</option>
<option value = "6">June</option>
<option value = "7">July</option>
<option value = "8">August</option>
<option value = "9">September</option>
<option value = "10">October</option>
<option value = "11">November</option>
<option value = "12">December</option>
</select>
BUT my lecturer discourages that...he requested that i do a javascript...i managed to find one...but it returns a string..
eg. if i select Jun...it returns jun...but i would like a 6 instead...
furthermore this script has some error...the drop down list shows 2 Mar and no Feb...
<script type="text/javascript">
function writeMonthOptions()
{
var theMonth;
var monthCounter;
var theDate = new Date();
for (monthCounter = 0; monthCounter < 12; monthCounter++)
{
theDate.setMonth(monthCounter);
theMonth = theDate.toString()
theMonth = theMonth.substr(4,3);
document.write('<OPTION value=' + theMonth + '>' + theMonth);
}
}
</script>
<select name="Mth" class="formlist">
<option></option>
<SCRIPT LANGUAGE=JavaScript>
writeMonthOptions();
</SCRIPT>
</select>
help please...thank u!