This is what I am trying to do. Three select drop downs (year, month, day). The user will select year, then month, and the JavaScript will populate the day with the correct number of days for that month/year.
I have a javascript function to find the number of days in that month/year selection. I am using onChange on the month field, but here is where i am running into the problem. I can't for the life of me remember the way to send the values for the year and the month to the function. I have done it before but that code is saved at my office state side.
Code:
Birthday
<br>
Year:
<select name="year">
<option value="NULL">Select 1st
<?php
$year = $date[year];
$eyear = $year - 17;
$oyear = $eyear - 100;
while ($eyear >= $oyear)
{
print "<OPTION VALUE=\"" . $eyear . "\">" . $eyear . "\n ";
$eyear--;
}
?>
</select>
Month:
<select name="month" onchange="getDate(this.value);">
<option value="NULL">Select 2nd
<option value="00">January
<option value="01">February
<option value="02">March
<option value="03">April
<option value="04">May
<option value="05">June
<option value="06">July
<option value="07">August
<option value="08">September
<option value="09">October
<option value="10">November
<option value="11">December
</select>
Day:
<select name="day">
</select>
// Runs month and year to get the days in that motnh for that year
function getDate(year, month)
{
var over = 32 - new Date(year, month, 32).getDate();
var day = new Array();
var count = 0;
while (over>0)
{
day[count] = over;
over = over - 1;
count = count - 1;
}
}