I can't seem to figure out a way around this vague "Object Expected" error. I am creating a page in which the user fills out a form to attend a concert. The error appears in my function "totalBill" and it has to do with the "city" and "dates" objects.
- The error occurs at
j=dates.selectedIndex;
andk=city.selectedIndex;
- I will include snippets of code that I think has to do with the error.
This is 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 body (form) section, the user makes the selection of 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>