/ Published in: JavaScript

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function checkDOB() { var date = new Date(); var full18 = new Date(date.getFullYear() - 18, date.getMonth(), date.getDate()); var dob = new Date(form['yyyy'].value, form['mm'].value, form['dd'].value); if (full18 < dob) { 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.'); return false; } }
Comments
