|
-
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.
-
Nov 9th, 2011, 03:00 AM
#2
Re: help with if statements please
Try this:
Code:
if(PickupTown == "Heywood" && DestinationAddress == "Manchester Airport") {InitFare = 25;}//Heywood-ManA-£25.
else if(DestinationTown == "Heywood" && PickupAddress == "Manchester Airport") {InitFare = 27;}//ManA-Heywood-£27.
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Nov 9th, 2011, 08:58 PM
#3
Thread Starter
Hyperactive Member
Re: help with if statements please
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
|