Attempting to have the user input four numbers, where they are, and their destination. Then have the output which direction they will be heading.
No matter which values I enter the same thing happens. How can I make the code use the results of the prompts?
var output = document.getElementById("output");
var number=prompt ("What is your current Latitude?");
var number=prompt ("What is your current Longitude?");
var number=prompt ("What is your destination Latitude?");
var number=prompt ("What is your destination longitude?");
var intCurrentLatitude = 0;
var intCurrentLongitude = 0;
var intDestinationLatitude = 0;
var intDestinationLongitude = 0;
if ( (intCurrentLatitude<=intDestinationLatitude) && (intCurrentLongitude<=intDestinationLongitude) ) {
output.textContent = "We'd be headed North East, capt'n!";
}
else if ( ( intCurrentLatitude<=intDestinationLatitude) && (intCurrentLongitude>=intDestinationLongitude) ) {
output.textContent = "Ye'd best head North West, captain!";
}
else if ( ( intCurrentLatitude>=intDestinationLatitude) && (intCurrentLongitude>=intDestinationLongitude) ) {
output.textContent = "Ye'd best head South West, captain!";
}
else if ( ( intCurrentLatitude>=intDestinationLatitude) && (intCurrentLongitude<=intDestinationLongitude) ) {
output.textContent = "Ye'd best head South East, captain!";
}
else{
output.textContent = "Land Ho!";
}
HTML
<head>
<meta charset="utf-8">
<title>More if</title>
<body>
<div id= "output">
<div id= "input2">
</div>
</body>
<script src="moreif.js"></script>
<script src="moreif2.js"></script>
</head>
</html>