|
-
Nov 8th, 2011, 11:35 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] help with if statements please
Im back working on improving my taxi fare calculator, I'm trying to create a number of set fares, if you take a look at the code its pretty self explanatory. I get as far as 123 showing as the fare, so i think i've messed up the if statements.
Code:
function CheckSetFare() {
var PickupTown = document.getElementById("input_3_city").value;//get town/city data from pickup
var DestinationTown = document.getElementById("input_8_city").value;//get town/city data from destination
var DestinationAddress = document.getElementById("j-destination").value;// get destination address data
var PickupAddress = document.getElementById("j-address").value;// get pickup address data
var InitFare = 123;
if(PickupTown == "Heywood" + DestinationAddress == " Manchester Airport "){InitFare = 25};//Heywood-ManA-£25.
if(DestinationTown == "Heywood" + PickupAddress == "Manchester Airport"){InitFare = 27};//ManA-Heywood-£27.
document.getElementById("initial-fare").value = InitFare;//replace quoted fare with new set fare for car.
document.getElementById("input_18").value = InitFare;//replace quoted fare with new set fare for car.
}
Thanks Chris1990
If your question is answered then mark your thread RESOLVED and give credit to whoever answered it.
If you fail, try and try again, its the only way to success.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|