Skip to content

Instantly share code, notes, and snippets.

@matthewmorrone
Created December 11, 2020 16:44
Show Gist options
  • Save matthewmorrone/38d2ffff22fcc73569d6d9fac18ae03b to your computer and use it in GitHub Desktop.
Save matthewmorrone/38d2ffff22fcc73569d6d9fac18ae03b to your computer and use it in GitHub Desktop.
<html>
<body>
<p>If the language you speak is not on the list, you can include it in the URL</p>
<select><script>
var option = decodeURIComponent(document.location.hash.substring(1));
document.write("<OPTION value=1>English</OPTION>");
document.write("<OPTION value=2>French</OPTION>");
document.write("<OPTION value=3>"+option+"</OPTION>");
function htmlEncode(userInput) {
var div = document.createElement('div');
var text = document.createTextNode(userInput);
div.appendChild(text);
return div.innerHTML;
};
</script></select>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment