Skip to content

Instantly share code, notes, and snippets.

@joellusky
Created August 13, 2014 23:44
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 joellusky/e2dc868a8ae9d6265d8d to your computer and use it in GitHub Desktop.
Save joellusky/e2dc868a8ae9d6265d8d to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="name.js"></script>
<title>JS Bin</title>
</head>
<body>
<form>
<input type="text" onChange="changeStuff(this);" id="firstname" placeholder="name">
</form>
</body>
</html>
function changeStuff(){
var name = document.getElementById("firstname").value;
switch(name) {
case 'Rima':
alert("Hallo Welt!");
break;
case 'Juha':
alert("Hei maailma!");
break;
case 'Diego':
alert("Hola Mundo!");
break;
case 'Jo':
alert("Hei maailma!");
break;
default:
alert("Hello World!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment