I am trying to have the user input four numbers, where they are at and there destination then have the output which direction they will be heading.It seems to be doing nothing.
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>
Aucun commentaire:
Enregistrer un commentaire