Joined: Wed Dec 14, 2011 4:30 pm Posts: 1 Has thanked: 0 time Have thanks: 0 time
so im relatively new to javascript and am having problems with 18+ form validation. i can get it to run and verify age, but it will let you in to the page regardless of age......how would i have this stop?? for some reason it wont let me upload the file, but here is the code
Code:
<html> <head> <title>Age Verification</title>
<script type="text/javascript" src="blizz.js"></script> <script type="text/javascript" src="blizz.js"></script> <link href="blizz.css" rel="stylesheet" type="text/css"> <script type="text/javascript" language="javascript"> function checkAge() { /* the min age to allow in */ var min_age = 18;
var year = parseInt(document.forms["Verify"]["year"].value); var month = parseInt(document.forms["Verify"]["month"].value) - 1; var day = parseInt(document.forms["Verify"]["day"].value);
var theirDate = new Date((year + min_age), month, day); var today = new Date;
if ( (today.getTime() - theirDate.getTime()) < 0) { alert("You are too young to enter this site!"); return false;