JulieB
10-10-2003, 07:36 AM
I found this code on this site, and it is almost exactly what I'm looking for. But I'd really like to be able to have additional pages, each time someone returns to the web site -- say 7 pages -- so if they come back 7 times, they see a new page. Then have it start over again with the first and go through a cycle of sorts. I'm hoping someone can help me modify the text below or suggest another source?
Thanks for your time and consideration.
Regards,
Julie
______________________________________
<!-- THREE STEPS TO INSTALL COOKIE - FORWARD REPEAT VISITORS:
1. Paste the specified code into the HEAD of your index.html page
2. Update the URLs to reflect your sites pages -->
<!-- STEP ONE: Copy this code into the HEAD of the index.html page -->
<HEAD>
<SCRIPT LANGUAGE = "JavaScript">
<!-- Original: Mattias Sjoberg -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
var expDays = 30;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var revisit = GetCookie('revisit');
if (revisit == null) {
SetCookie('revisit', 1, exp);
window.location='revisit2.html';
}
else {
window.location='revisit2-source.html';
}
// End -->
</SCRIPT>
<!-- STEP TWO: Be sure to update the URLs to reflect your site -->
<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size: 2.24 KB -->
Thanks for your time and consideration.
Regards,
Julie
______________________________________
<!-- THREE STEPS TO INSTALL COOKIE - FORWARD REPEAT VISITORS:
1. Paste the specified code into the HEAD of your index.html page
2. Update the URLs to reflect your sites pages -->
<!-- STEP ONE: Copy this code into the HEAD of the index.html page -->
<HEAD>
<SCRIPT LANGUAGE = "JavaScript">
<!-- Original: Mattias Sjoberg -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
var expDays = 30;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var revisit = GetCookie('revisit');
if (revisit == null) {
SetCookie('revisit', 1, exp);
window.location='revisit2.html';
}
else {
window.location='revisit2-source.html';
}
// End -->
</SCRIPT>
<!-- STEP TWO: Be sure to update the URLs to reflect your site -->
<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size: 2.24 KB -->