How to calculate the total of the value of two drop down menus that has been selected by the user. I have no pre determined values in HTML. Here is my code, i want to multiply the number of tickets by the price selected and show it to the user. thanks.
HTML
<select name="price" id="price" style="width:120px">
<option>Select Price</option>
</select>
<br>
<br>
<select name="tickets" id="tickets" style="width:120px">
<option>Select Tickets</option>
</select>
<br>
<br>
<input name="button" type="button" value="Submit" onClick="return validate2()"/>
<input name="reset" type="reset" value="Reset" />
</form>
JavaScript
switch (artist.selectedIndex)
{
case 0:
var venueList = ["Select Venue"];
var dateList = ["Select Date"];
var ticketList = ["Select Tickets"];
var priceList = ["Select Price"];
fillList(venue, venueList);
fillList(date, dateList);
fillList(ticket, ticketList);
fillList(price, priceList);
break;
case 1:
var venueList = ["Select Venue", "London"];
var dateList = ["Select Date", "17th July", "18th July"];
var ticketList = ["Select Tickets", "1", "2", "3", "4", "5", "6"];
var priceList = ["Select Price", "£30", "£45", "£70"];
fillList(venue, venueList);
fillList(date, dateList);
fillList(ticket, ticketList);
fillList(price, priceList);
break;
case 2:
var venueList = ["Select Venue", "Manchester", "Glasgow"];
var dateList = ["Select Date"]
var ticketList = ["Select Tickets", "1", "2", "3", "4", "5", "6"];
var priceList = ["Select Price", "£35", "£50", "£60"];
fillList(venue, venueList);
fillList(date, dateList);
fillList(ticket, ticketList);
fillList(price, priceList);
// adding onchange event on venue when the user selects rod stewart
venue.onchange = function ()
{
var dateList;
switch(venue.selectedIndex)
{
case 0: dateList = ["Select Date"]; break;
case 1: dateList = ["Select Date", "18th July", "20th July"]; break;
case 2: dateList = ["Select Date", "22nd July", "23rd July"]; break;
}
fillList(date, dateList);
}
break;