I am trying to check if a date of birth entered in a form is between several dates and then populate another field based on the date of birth entered. I cannot seem to get it to read the dates.
Here is the function
function repeat()
{
if(document.myform.dob1.value <='09/01/2005' && document.myform.dob1.value >='08/31/2006')
document.myform.class1.value='Class 1';
else
document.myform.class1.value='Class 2';
}
Here is the form:
<body>
<form name="myform" method="post" action="insert_entries.php">
<table style="width: 139%" align="center">
<tr>
<td class="style2" style="width: 166px"><strong>FIRST NAME</strong></td>
<td class="style2" style="width: 161px"><strong>LAST NAME</strong></td>
<td class="style2" style="width: 66px"><strong>GENDER</strong></td>
<td class="style2" style="width: 224px"><strong>DOB</strong></td>
<td class="style2" style="width: 74px"><strong>CLASS</strong></td>
<td class="style2" style="width: 104px"><strong>EVENT 1</strong></td>
<td class="style2" style="width: 104px"><strong>EVENT 2</strong></td>
</tr>
<tr>
<td style="width: 166px">
<input type="text" name="first1" size="35" style="width: 155px" /></td>
<td style="width: 161px">
<input type="text" name="last1" size="35" style="width: 155px" /></td>
<td style="width: 66px">
<select name="gender1" class="dropdownbox" id="series id15"style="height: 23px; width: 70px">
<option></option>
<option>M</option>
<option>F</option>
</select></td>
<td style="width: 224px">
<input type="date" name="dob1" size="35" onchange = "repeat()" style="width: 155px; height: 27px;" /></td>
<td style="width: 74px">
<input type="text" name="class1" size="35" style="width: 155px" /></td>
<td style="width: 104px">
<select name="events1" class="dropdownbox" id="series id"style="height: 23px; width: 104px">
<option></option>
</select> </td>
<td style="width: 72px">
<select name="events1B" class="dropdownbox" id="series id16"style="height: 23px; width: 104px">
<option></option>
</select> </td>
</tr>
</table>
No matter what date I put in the field is always populated with "Class 2"