Hmmm.. ok i find 1 script but i don't know what to change in it to make it when u pres submit to redirect u into the site If u are over 14 and if u are under to make u go to the restrict page.
And then automatically when u go to my site to redirect you to the Site or to the Restrict page...
Here is the code in the Page to put in
// Assumptions
// 3 form select fields with id= "month", "day", and "year"
//
//
function updateDays()
{
var i;
var monthDays = [31,29,31,30,31,30,31,31,30,31,30,31];
var monthSelect = document.getElementById("month");
var daySelect = document.getElementById("day");
var mIndex = monthSelect.selectedIndex-1;
var days = monthDays[mIndex];
daySelect.length = days+1;
for (i=1; i <= days; i++)
{
daySelect.options[i].text = i;
daySelect.options[i].value = i;
}
}
function getFullYear(d)
{
var y = d.getYear();
if (y < 1000) y += 1900;
return y;
}
function setYears()
{
var i, j;
var yearsBack = 60;
var today = new Date();
var thisYear = getFullYear(today);
var firstYear = thisYear - yearsBack; //go back 60 years - should be enough
var yearSelect = document.getElementById("year");
yearSelect.length = yearsBack+2;
j = thisYear;
for ( i=1; i <= yearsBack+2; i++ )
{
yearSelect.options[i].text = j;
yearSelect.options[i].value = j;
j--;
}
}
function isOldEnough(minYears)
{
var today = new Date();
var monthSelect = document.getElementById("month");
var daySelect = document.getElementById("day");
var yearSelect = document.getElementById("year");
if (yearSelect.selectedIndex != 0 || monthSelect.selectedIndex != 0 && daySelect.selectedIndex != 0)
{
var birthYear = yearSelect.options[yearSelect.selectedIndex].value;
var birthMonth = monthSelect.selectedIndex-1;
var birthDay = daySelect.selectedIndex
var years = getFullYear(today) - birthYear;
var months = today.getMonth() - birthMonth;
var days = today.getDate() - birthDay;
if (days < 0) months--;
if (months < 0) years--;
if (years >= minYears)
return true;
}
return false;
}
function dropCookiePass(name)
{
var expiresDate = new Date();
expiresDate.setFullYear( getFullYear(expiresDate) + 1 ); // expires in a year
document.cookie = name + "=true;expires=" + expiresDate.toString();
}
function dropCookieRestrict(name, expiresDate)
{
document.cookie = name + "=false;expires=" + expiresDate.toString();
}
function cookieStore(name, expiresDate)
{
document.cookie = name + "=false;expires=" + expiresDate.toString();
}
function cookieExists(name)
{
var allcookies = document.cookie;
var pos = allcookies.indexOf(name);
if (pos == -1)
return false;
else
return true;
}
function isRestricted(name)
{
var allcookies = document.cookie;
var key=name+"=";
var start = allcookies.indexOf(key);
var end;
if (start != -1)
{
start += key.length;
end = allcookies.indexOf(';', start);
if (end == -1) end = allcookies.length;
var cookieval = allcookies.substring(start, end);
if (cookieval=="false")
return true;
}
return false;
}
function getExpirationDate(age)
{
var today = new Date();
var monthSelect = document.getElementById("month");
var daySelect = document.getElementById("day");
var yearSelect = document.getElementById("year");
var birthYear = yearSelect.options[yearSelect.selectedIndex].value;
var birthMonth = monthSelect.selectedIndex-1;
var birthDay = daySelect.selectedIndex
var years = getFullYear(today) - birthYear;
var months = today.getMonth() - birthMonth;
var days = today.getDate() - birthDay;
if (days < 0) months--;
if (months < 0) years--;
var ofAgeDate = new Date()
ofAgeDate.setDate(birthDay);
ofAgeDate.setMonth(birthMonth);
ofAgeDate.setFullYear(parseInt(birthYear) + (age - years));
ofAgeDate.setHours(0);
ofAgeDate.setMinutes(0);
ofAgeDate.setSeconds(0);
return ofAgeDate;
}
function isOfAge(age,name,denyPage)
{
if (!isOldEnough(age))
{
dropCookieRestrict(name, getExpirationDate(age));
location.href = denyPage;
return false;
}
else
{
dropCookiePass(name);
return true;
}
}
function allFieldsSelected()
{
var monthSelect = document.getElementById("month");
var daySelect = document.getElementById("day");
var yearSelect = document.getElementById("year");
if (yearSelect.selectedIndex != 0 || monthSelect.selectedIndex != 0 && daySelect.selectedIndex != 0)
return true;
else
return false;
}
// site specific age gate cookie check
var tag = "MK_DCU";
function checkAge()
{
if ( allFieldsSelected() )
{
return isOfAge(13, tag,"restricted.html");
}
alert ("All birth date fields must be selected");
return false;
}
var url = document.URL.toString();
if (url.indexOf("index.html") != -1)
{
if (cookieExists(tag))
{
if (isRestricted(tag))
{
location.href = 'restricted.html';
}
else
{
location.href = 'main.html';
}
}
}
else if (url.indexOf("main.html") != -1)
{
if (cookieExists(tag))
{
if (isRestricted(tag))
{
location.href = 'restricted.html';
}
}
else
{
location.href = 'index.html'; // go to age gate page
}
}
else
{
if (cookieExists(tag))
{
if (isRestricted(tag))
{
location.href = 'restricted.html';
}
else
{
location.href = 'main.html';
}
}
else
{
location.href = 'index.html'; // go to age gate page
}
}
And here is the Code in the agegate.js
<script type="text/javascript" language="javascript" src="agegate.js"></script>
</head>
<body id="home_ag" onload="javascript:setYears();">
<div id="pgcenter_ag">
<div id="age_gate">
<form action="main.html" onsubmit="return checkAge();">
<select id="month" name="month" onchange="javascript:updateDays();" >
<option value="">[ Month ]</option>
<option value="January">January</option>
<option value="February">February</option>
<option value="March">March</option>
<option value="April">April</option>
<option value="May">May</option>
<option value="June">June</option>
<option value="July">July</option>
<option value="August">August</option>
<option value="September">September</option>
<option value="October">October</option>
<option value="November">November</option>
<option value="December">December</option>
</select>
<select id="day" name="day">
<option>[ Day ]</option>
</select>
<select id="year" name="year">
<option>[ Year ]</option>
</select>
<input type="image" src="img/submit.jpg" name="" value="Submit" id="">
</form>
</div>
So now help me whit this thing..