Posted By

RuslanSavenok on 12/18/10


Tagged

check user AGE


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

lanabear


Check Date of Birth


 / Published in: JavaScript
 

  1. function checkDOB() {
  2. var date = new Date();
  3. var full18 = new Date(date.getFullYear() - 18, date.getMonth(), date.getDate());
  4. var dob = new Date(form['yyyy'].value, form['mm'].value, form['dd'].value);
  5.  
  6. if (full18 < dob) {
  7. alert('You must be 18 years or older to be eligible for this offer. Please enter your correct Date of Birth or click Pass to see the next offer.');
  8. return false;
  9. }
  10. }

Report this snippet  

You need to login to post a comment.