function setFocus()
{
if(document . getElementById("ctl00_ContentPlaceHolder1_divUnderAge13") . style . display =='block')
{
document . getElementById("ctl00_ContentPlaceHolder1_divUnderAge13") . style . display='none';
document . getElementById("ctl00_ContentPlaceHolder1_divUnderAge13") . style . visibility='hidden';
}
document . getElementById("ctl00_ContentPlaceHolder1_txtDateOfBirth") . focus();
document . getElementById("ctl00_ContentPlaceHolder1_imgBtnNext") . disabled = true;
return false;
}
function chkDobAge()
{
// function for DOB
ctrl = document . getElementById('ctl00_ContentPlaceHolder1_txtDateOfBirth');
if(ctrl . value=="" || ctrl . value=="mm/dd/yyyy" )
{
alert('Please enter date of birth');
ctrl . focus();
return false;
}
var str=ctrl . value;
if((str . charCodeAt(0)==32))
{
alert('Date of birth must not be start with a blank character');
ctrl . value="";
ctrl . focus();
return false;
}
var RegExPattern = /^(?=\d)(?:(?:(?:(?:(?:0?[13578]|1[02])(\/|-|\ . )31)\1|(?:(?:0?[1,3-9]|1[0-2])(\/|-|\ . )(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})|(?:0?2(\/|-|\ . )29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))|(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\ . )(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2}))($|\ (?=\d)))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\ [AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$/;
var errorMessage = 'Please enter valid date as month, day, and four digit year . \nYou may use a slash, hyphen or period to separate the values . \nThe date must be a real date . 2-30-2000 would not be accepted . \nFormay mm/dd/yyyy . ';
if ((ctrl . value . match(RegExPattern)) && (ctrl . value!=''))
{
}
else
{
alert('Enter valid date in US format(MM/DD/YYYY)');
ctrl . focus();
ctrl . value="";
return false;
}
var objDate = ctrl . value;
var currentTime = new Date();
var month = currentTime . getMonth() + 1
var day = currentTime . getDate()
var year = currentTime . getFullYear()
var objCurrentDate=month + "/" + day + "/" + year;
if (Date . parse(objDate) >= Date . parse(objCurrentDate))
{
alert('Date of birth should not be greater than current date');
ctrl . value="";
ctrl . focus();
return false;
}
// end of fucntion DOB
//chk age
//// Getin the DOB
var DOBmdy = (document . getElementById("ctl00_ContentPlaceHolder1_txtDateOfBirth") . value) . split('/');
// Created date object for geting previous 13 year date
var DOBmdyMonth = DOBmdy[0] -1;
var myDate=new Date();
// Geting the previous dates
var Previousdate = myDate . getDate();
var PreviousMonth = myDate . getMonth();
var CurrentYear = myDate . getFullYear();
var PreviousYear = CurrentYear-13;
// End of // Geting the previous dates
// to find that DOB is in Leap year It it return 0 that mean it is leap year
var leapyear = DOBmdy[2]%4;
if (leapyear == 0)
{
// now check that month of leap year is Fab
if(DOBmdyMonth == 1)
{
// if month is Fab then check that date of month is 29
if(DOBmdy[1]== 29)
{
// now compare with 1 March Becz 29 is not in Fab month now
if(DOBmdy[2] < PreviousYear)
{
document . getElementById("ctl00_ContentPlaceHolder1_imgBtnNext") . disabled = false;
}// condition DOBmdy[2] < PreviousYear end of if scope of if year is less
else if((DOBmdy[2] == PreviousYear) && (DOBmdyMonth < PreviousMonth))
{
document . getElementById("ctl00_ContentPlaceHolder1_imgBtnNext") . disabled = false;
}
else if( (DOBmdy[2] == PreviousYear) && (DOBmdyMonth == PreviousMonth) && (DOBmdy[1] > 1))// here 1 is 1t march
{
document . getElementById("ctl00_ContentPlaceHolder1_imgBtnNext") . disabled = false;
}
else
{
var divEmailPreviewMain = document . getElementById("ctl00_ContentPlaceHolder1_divUnderAge13");
divEmailPreviewMain . style . display='block';
divEmailPreviewMain . style . visibility='visible';
divEmailPreviewMain . style . position="absolute";
divEmailPreviewMain . style . top = '400px';
divEmailPreviewMain . style . left= '350px';
document . getElementById("ctl00_ContentPlaceHolder1_imgBtnNext") . disabled = true;
return false;
}
// check that user is able to join site or not
if(DOBmdy[2]
} // condition DOBmdy[2]
{
var divEmailPreviewMain = document . getElementById("ctl00_ContentPlaceHolder1_divUnderAge13");
divEmailPreviewMain . style . display='block';
divEmailPreviewMain . style . visibility='visible';
divEmailPreviewMain . style . position="absolute";
divEmailPreviewMain . style . top = '400px';
divEmailPreviewMain . style . left= '350px';
document . getElementById("ctl00_ContentPlaceHolder1_imgBtnNext") . disabled = true;
return false;
}// condition DOBmdy[2]
}// condition Previousdate == 29 end of If Scope
else
{
if((DOBmdy[2] < PreviousYear) && (DOBmdy[1] < Previousdate) && (DOBmdyMonth < PreviousMonth))
{
}// if conditon for okay user ((DOBmdy[2] < PreviousYear) && (DOBmdy[1] < Previousdate) && (DOBmdyMonth < PreviousMonth))
else
{
var divEmailPreviewMain = document . getElementById("ctl00_ContentPlaceHolder1_divUnderAge13");
divEmailPreviewMain . style . display='block';
divEmailPreviewMain . style . visibility='visible';
divEmailPreviewMain . style . position="absolute";
divEmailPreviewMain . style . top = '400px';
divEmailPreviewMain . style . left= '350px';
document . getElementById("ctl00_ContentPlaceHolder1_imgBtnNext") . disabled = true;
return false;
} // end of Else scope of condition ((DOBmdy[2] < PreviousYear) && (DOBmdy[1] < Previousdate) && (DOBmdyMonth < PreviousMonth))
}//condition Previousdate == 29 end of Else Scope
}// condition CurrentMonth end of If Scope
} // condition leapyear == 0 end of If Scope
// end of check that month of leap year is Fab
// if DOB is in normal year
// second attempt for DOB normal text
// if year is less
if(DOBmdy[2] < PreviousYear)
{
document . getElementById("ctl00_ContentPlaceHolder1_imgBtnNext") . disabled = false;
}// condition DOBmdy[2] < PreviousYear end of if scope of if year is less
else if((DOBmdy[2] == PreviousYear) && (DOBmdyMonth < PreviousMonth))
{
document . getElementById("ctl00_ContentPlaceHolder1_imgBtnNext") . disabled = false;
}
else if( (DOBmdy[2] == PreviousYear) && (DOBmdyMonth == PreviousMonth) && (DOBmdy[1] < Previousdate))
{
document . getElementById("ctl00_ContentPlaceHolder1_imgBtnNext") . disabled = false;
}
else if( (DOBmdy[2] == PreviousYear) && (DOBmdyMonth == PreviousMonth) && (DOBmdy[1] == Previousdate))
{
document . getElementById("ctl00_ContentPlaceHolder1_imgBtnNext") . disabled = false;
}
else
{
var divEmailPreviewMain = document . getElementById("ctl00_ContentPlaceHolder1_divUnderAge13");
divEmailPreviewMain . style . display='block';
divEmailPreviewMain . style . visibility='visible';
divEmailPreviewMain . style . position="absolute";
divEmailPreviewMain . style . top = '400px';
divEmailPreviewMain . style . left= '350px';
document . getElementById("ctl00_ContentPlaceHolder1_imgBtnNext") . disabled = true;
return false;
}
//end of chk age
}
function registration()
{
var ctrl = document . getElementById('ctl00_ContentPlaceHolder1_txtEmailAddress');
if(ctrl . value=="" )
{
ctrl . focus();
alert('Please enter email address');
return false;
}
var emailReg = /^(([^<>()[\]\\ . ,;:\s@\"]+(\ . [^<>()[\]\\ . ,;:\s@\"]+)*)|(\" . +\"))@((\[[0-9]{1,3}\ . [0-9]{1,3}\ . [0-9]{1,3}\ . [0-9]{1,3}\])|(([a-zA-Z\-0-9]+\ . )+[a-zA-Z]{2,}))$/
if (! ctrl . value . match(emailReg))
{
alert('Enter valid email address');
ctrl . value="";
ctrl . focus();
return false;
}
// end of email id
// first name
ctrl = document . getElementById('ctl00_ContentPlaceHolder1_txtFirstName');
if(ctrl . value=="" )
{
alert('Enter first name');
ctrl . focus();
return false;
}
var str=ctrl . value;
if((str . charCodeAt(0)==32))
{
alert('First name must not be start with a blank character');
ctrl . value="";
ctrl . focus();
return false;
}
var name=ctrl . value;
for(i=0;i
if(!((name . charCodeAt(i)>=65 && name . charCodeAt(i)<=90)||(name . charCodeAt(i)>=97 && name . charCodeAt(i)<=122)||(name . charCodeAt(i)==32)))
{
alert('Enter valid first name');
ctrl . value="";
ctrl . focus();
return false
}
}
// end of first name
// function for last name
ctrl = document . getElementById('ctl00_ContentPlaceHolder1_txtLastName');
if(ctrl . value=="" )
{
ctrl . focus();
alert('Enter last name');
return false;
}
var str=ctrl . value;
if((str . charCodeAt(0)==32))
{
alert('Last name must not be start with a blank character');
ctrl . value="";
ctrl . focus();
return false;
}
var name=ctrl . value;
for(i=0;i
if(!((name . charCodeAt(i)>=65 && name . charCodeAt(i)<=90)||(name . charCodeAt(i)>=97 && name . charCodeAt(i)<=122)||(name . charCodeAt(i)==32)))
{
alert('Enter valid last name');
ctrl . value="";
ctrl . focus();
return false
}
}
// end of function for last name
// function for screen name
ctrl = document . getElementById('ctl00_ContentPlaceHolder1_txtScreenName');
if(ctrl . value=="" || ctrl . value=="eg . nycgirl100 . . . ")
{
ctrl . focus();
alert('Enter screen name');
return false;
}
var str=ctrl . value;
if((str . charCodeAt(0)==32))
{
alert('Screen name must not be start with a blank character');
ctrl . value="";
ctrl . focus();
return false;
}
// end of function for screen name
// fucntion for password
ctrl = document . getElementById('ctl00_ContentPlaceHolder1_txtPassword');
if(ctrl . value=="" )
{
ctrl . focus();
alert('Please enter password');
return false;
}
var str=ctrl . value;
if((str . charCodeAt(0)==32))
{
alert('Password must not be start with a blank character');
ctrl . value="";
ctrl . focus();
return false;
}
var str=ctrl . value;
if((str . length)< 6 )
{
alert('Password must be atleast six character');
ctrl . focus();
ctrl . value="";
return false
}
// end funtion for password
// function for confirmation password
ctrl = document . getElementById('ctl00_ContentPlaceHolder1_txtConfirmPassword');
if(ctrl . value=="" )
{
ctrl . focus();
alert('Please enter confirm Password ');
return false;
}
var str=ctrl . value;
if((str . charCodeAt(0)==32))
{
alert('Confirm password must not be start with a blank character');
ctrl . value="";
ctrl . focus();
return false;
}
var str=ctrl . value;
if((str . length)< 6 )
{
alert('Confirm password must be atleast six character');
ctrl . focus();
ctrl . value="";
return false
}
var txtPassword = document . getElementById('ctl00_ContentPlaceHolder1_txtPassword');
if(ctrl . value != txtPassword . value)
{
alert('Confirm password should be same as the Password ');
ctrl . value="";
txtPassword . value="";
txtPassword . focus();
return false;
}
// end function for confirmation passoword
// function for zipcode
ctrl = document . getElementById('ctl00_ContentPlaceHolder1_txtZipCode');
if(ctrl . value=="" )
{
ctrl . focus();
alert('Please enter zipcode');
return false;
}
var str=ctrl . value;
if((str . charCodeAt(0)==32))
{
alert('Zipcode must not be start with a blank character');
ctrl . value="";
ctrl . focus();
return false;
}
var zip;
zip=ctrl . value;
for(i=0;i
if(!((zip . charCodeAt(i)>=48) && (zip . charCodeAt(i)<=57)))
{
alert('Enter digits between 0-9');
ctrl . focus();
ctrl . value="";
return false
}
}
var str=ctrl . value;
if((str . length) != 5)
{
alert('Enter US zipcode only');
ctrl . focus();
ctrl . value="";
return false
}
// end for function zipcode
// function for DOB
ctrl = document . getElementById('ctl00_ContentPlaceHolder1_txtDateOfBirth');
if(ctrl . value=="" || ctrl . value=="mm/dd/yyyy" )
{
alert('Please enter date of birth');
ctrl . focus();
return false;
}
var str=ctrl . value;
if((str . charCodeAt(0)==32))
{
alert('Date of birth must not be start with a blank character');
ctrl . value="";
ctrl . focus();
return false;
}
var RegExPattern = /^(?=\d)(?:(?:(?:(?:(?:0?[13578]|1[02])(\/|-|\ . )31)\1|(?:(?:0?[1,3-9]|1[0-2])(\/|-|\ . )(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})|(?:0?2(\/|-|\ . )29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))|(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\ . )(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2}))($|\ (?=\d)))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\ [AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$/;
var errorMessage = 'Please enter valid date as month, day, and four digit year . \nYou may use a slash, hyphen or period to separate the values . \nThe date must be a real date . 2-30-2000 would not be accepted . \nFormay mm/dd/yyyy . ';
if ((ctrl . value . match(RegExPattern)) && (ctrl . value!=''))
{
}
else
{
alert('Enter valid date in US format(MM/DD/YYYY)');
ctrl . focus();
ctrl . value="";
return false;
}
var objDate = ctrl . value;
var currentTime = new Date();
var month = currentTime . getMonth() + 1
var day = currentTime . getDate()
var year = currentTime . getFullYear()
var objCurrentDate=month + "/" + day + "/" + year;
if (Date . parse(objDate) >= Date . parse(objCurrentDate))
{
//alert("The dates are valid . ");
alert('Date of birth should not be greater than current date');
ctrl . value="";
ctrl . focus();
return false;
}
// end of fucntion DOB
// function for sex
ctrl1 = document . getElementById('ctl00_ContentPlaceHolder1_rbtGenderMale');
ctrl2 = document . getElementById('ctl00_ContentPlaceHolder1_rbtGenderFemale');
if (ctrl1 . checked ==false )
{
if(ctrl2 . checked==false)
{
alert('Select gender');
return false;
}
}
// end of function for sex
//function for Pic extension
ctrl = document . getElementById("ctl00_ContentPlaceHolder1_picName");
if(document . getElementById("ctl00_ContentPlaceHolder1_picName") . value!="")
{
var photo=ctrl . value;
var index=photo . lastIndexOf(" . ");
var temp=photo . substring(index+1,(photo . length));
temp=temp . toUpperCase();
if(!(temp=="BMP" || temp=="JPG" || temp=="JPEG" || temp=="GIF"))
{
alert('Select an Bmp, Jpg or Gif file');
ctrl . value="";
ctrl . focus();
return false;
}
}
// end function for pic extension
// function for cpathcha image
ctrl = document . getElementById('ctl00_ContentPlaceHolder1_txtForVerficationOfCode');
if(ctrl . value=="" )
{
ctrl . focus();
alert('Enter same character as in image');
return false;
}
var str=ctrl . value;
if((str . charCodeAt(0)==32))
{
alert('Verification code must not be start with a blank character');
ctrl . value="";
ctrl . focus();
return false;
}
if((str . length) != 7)
{
alert('Enter all image text');
ctrl . focus();
return false
}
// end of function for captcha image
return true;
}
No comments:
Post a Comment