Skip to content

Instantly share code, notes, and snippets.

@MartinIngesen
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartinIngesen/8be5221d3c6591b5897b to your computer and use it in GitHub Desktop.
Save MartinIngesen/8be5221d3c6591b5897b to your computer and use it in GitHub Desktop.
<!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