Last active
August 29, 2015 14:15
-
-
Save MartinIngesen/8be5221d3c6591b5897b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Flight Simulator Flight Planning Tool</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> | |
<script type="text/javascript"> | |
function buttonFunction(id) { | |
// this could be a switch-statement, but for simplicity it's not. | |
if (id === 1) { | |
// get value from input | |
var inputValue = $('#ICAO').val(); | |
// validate inputValue here. | |
if (inputValue === "") return; | |
// redirect user | |
window.location = "http://flightaware.com/live/airport/" + inputValue; | |
} | |
if (id === 2) { | |
// get value from input | |
var inputValue = $('#reg').val(); | |
// validate inputValue here. | |
if (inputValue === "") return; | |
// redirect user | |
window.location = "http://flightaware.com/live/flight/" + inputValue; | |
} | |
} | |
</script> | |
</head> | |
<body> | |
<h1>Flight Simulator Flight Planning Tool</h1> | |
<h2>FlightAware Resources</h2> | |
Enter ICAO identifier: | |
<input type="text" id="ICAO" /> | |
<button name="ICAObutton" onclick="buttonFunction(1)">Go!</button><br> | |
Enter aircraft registration: | |
<input type="text" id="reg" /> | |
<button name="ICAObutton" onclick="buttonFunction(2)">Go!</button><br> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment