Guest_imported
New member
- Jan 1, 1970
- 0
I have a page with 20 potential cookies:
e.g.,
var TheCookieName = form.nameA
var TheCookieName = form.nameB
etc.
Any ideas on how I can modify this script so that it will call and display only the latest cookie?
function GetCookie (CookieName) {
var cname = CookieName + "=";
var i = 0;
while (i < document.cookie.length) {
var j = i + cname.length;
if (document.cookie.substring(i, j) == cname){
var leng = document.cookie.indexOf (";", j);
if (leng == -1) leng = document.cookie.length;
return unescape(document.cookie.substring(j, leng));
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return "*";
}
e.g.,
var TheCookieName = form.nameA
var TheCookieName = form.nameB
etc.
Any ideas on how I can modify this script so that it will call and display only the latest cookie?
function GetCookie (CookieName) {
var cname = CookieName + "=";
var i = 0;
while (i < document.cookie.length) {
var j = i + cname.length;
if (document.cookie.substring(i, j) == cname){
var leng = document.cookie.indexOf (";", j);
if (leng == -1) leng = document.cookie.length;
return unescape(document.cookie.substring(j, leng));
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return "*";
}