Skip to content

Instantly share code, notes, and snippets.

@nickatnight
Last active December 28, 2015 23:19
Show Gist options
  • Save nickatnight/c77d4bab7d420c736770 to your computer and use it in GitHub Desktop.
Save nickatnight/c77d4bab7d420c736770 to your computer and use it in GitHub Desktop.
function getInput(e){
// only run if the user presses the enter key
if(e.keyCode == 13){
// validate input
var userIn = document.getElementById("userInput").value;
var soul = document.getElementById("sel");
var vally = soul.options[soul.selectedIndex].value;
var outFormat;
if(document.getElementById("decimal").checked) outFormat = 10;
else if(document.getElementById("hexidecimal").checked) outFormat = 16;
else outFormat = 2;
converter(vally, outFormat, userIn);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment