Struggling to find a solution for the mysterious "Object Expected" error that keeps popping up. Currently working on a concert attendance form page where users input their information. The pesky error is showing up in my function "totalBill," specifically with the objects "city" and "dates."
- Frustratingly, the error rears its head at
j=dates.selectedIndex;
andk=city.selectedIndex;
- I'll provide snippets of code that I suspect are related to the issue.
This snippet shows part of the function:
<script language="JavaScript" type="text/javascript">
var city2=" ";
var date2=" ";
function totalBill() {
with (document.coldplay) {
var j;
var k;
j = dates.selectedIndex;
k = city.selectedIndex;
if (dates.options[j].value == "1") {
date2 = " Friday, June 5th";
}
if (dates.options[j].value == "2") {
date2 = " Saturday, June 6th";
}
if (city.options[k].value == "Chicago") {
city2 = " Chicago";
}
if (city.options[k].value == "Austin") {
city2 = " Austin";
}
In the form section of the body, the user selects the city and date:
<select name="city">
City:
<option value= "Chicago"> Chicago, Illinois
<option value= "Austin"> Austin, Texas
<option value= "Miami"> Miami, Florida
</select><br>
</td>
<td>
<select name="dates">
Date:
<option value= "1"> Friday, June 5th
<option value= "2"> Saturday, June 6th
<option value= "3"> Friday, June 12th
<option value= "4"> Saturday, June 13th
<option value= "5"> Friday, June 19th
<option value= "6"> Saturday, June 20th
<option value= "7"> Friday, June 26th
<option value= "8"> Saturday, June 27th
</select>