Hey everyone
I have this code:
[CODE]<script><!–
function checkAgeCheckBox(f){
var dob=new Date();
var date=dob.getDate();
var month=dob.getMonth() + 1;
var year=dob.getFullYear();
var cmbmonth=parseInt(document.getElementById(“cmbmonth”).options[document.getElementById(“cmbmonth”).selectedIndex].value);
var cmbday=parseInt(document.getElementById(“cmbday”).options[document.getElementById(“cmbday”).selectedIndex].value);
var cmbyear=parseInt(document.getElementById(“cmbyear”).options[document.getElementById(“cmbyear”).selectedIndex].value);
age=year-cmbyear;
if(cmbmonth>month){age–;}
else{if(cmbmonth==month && cmbday>=date){age–;}}
if(cmbmonth==0){alert(“You must enter the month you were born in.”);return false;}
else if(cmbday==0){alert(“You must enter the day you were born on.”);return false;}
else if(cmbyear==2007){alert(“You must enter the year you were born in.”);return false;}
else if(age<18){alert(“You are Under 18 years of age and are prohibited from entering this site!”);location.replace(“http://www.google.co.uk/”);return false;}
else if(!document.getElementById(“agree”).checked){alert(‘Check the agree box to enter this site.’);return false;}
else{return true;}
}
// –></script>
It seems to work perfectly in Internet explorer 6 but does not work in IE7 or Firefox, this is for a university project and I need to have it working in Firefox. I thought that I had maybe disabled the browsers javascript or something but this is not the case as I have tested it on several different computers. Can anyone help or am i better just giving up?
ps. this sounds mad but it was working perfectly in Firefox and IE7 and i just happened to go back to it one day and it has stopped functioning.