Javascript Demo Code

<script type="text/javascript">
function checkAge(){
var age = prompt("Your age?", "") || "";

if (age >= 21) {
alert("You can vote and drink!");
} else if (age >= 18) {
alert("You can vote, but can't drink.");
} else {
alert("You cannot vote or drink.");
}
}
</script>

See this script code in action and tap the button.