0
   

Script not working for verifying age?

 
 
Karani
 
Reply Fri 31 Jan, 2014 01:25 am

$('.window .close .click').click(function test(e) {
//Cancel the link behavior
//e.preventDefault();
var year = $('#year').val();
var location = $('#location').val();
var currentTime = new Date()
var today = currentTime.getFullYear();
$('#info').hide();
$('#year').css('border','0px');
$('#month').css('border','0px');
$('#day').css('border','0px');
$('#location').css('border','0px');
if(today == year){
$('#info').html('You have not entered your age, Please enter your date of birth! ');
$('#info').css('color','red');
$('#year').css('border','#f00 solid 1px');
$('#month').css('border','#f00 solid 1px');
$('#day').css('border','#f00 solid 1px');
$('#info').show();
}
else{
if(year >(today-18)){
$('#info').html('You are only '+(today-year)+' years old. You are restricted from viewing the contents of this page! ');
$('#info').css('color','red');
$('#year').css('border','#f00 solid 1px');
$('#month').css('border','#f00 solid 1px');
$('#day').css('border','#f00 solid 1px');
$('#info').show();
}
else {
if(location == '' || location == null){
$('#info').html('Please let us know where you are, enter your location!');
$('#info').css('color','red');
$('#location').css('border','#f00 solid 1px');
$('#info').show();
}
else{
if($('#agree').is(':checked')){
setCookie("username",'username',1);
}
$('#mask').hide();
$('.window').hide();
}
}

}
});
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 493 • Replies: 0
No top replies

 
 

Related Topics

 
  1. Forums
  2. » Script not working for verifying age?
Copyright © 2025 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 1.19 seconds on 02/10/2025 at 10:00:04