I'm new to JavaScript and I'm making an exercise about content getting from html form. I din't want to mame a date picker. Just the checking. Here is some code:
<html>
<title>JavaScript example</title>
<script type="text/javascript">
function onload() {
var age = document.getElementById('v').value;
var res = (age >= 18) ? "Adult" : "Minor";
}
function open(){
alert(res);
}
</script>
<body onload="onload();">
<input type="text" name="AREA" value="" id="v"/>
<input type="button" value="click" onclick="open();"/>
</body>
</html>
My html works fine, but when I'm clicking the button all the page goes blank and nothing. Some help?