Cookie Question

P

Papajo

This is not a a PC question but just a javascript one, this script is
used on webtv.
The cookie on this script can be split into 3 different memory's, what
I am trying to do is to be able to call up a total cookie count of all 3
memory's, so far I can get the count of only one at a time.
  I am not a real time scripter so some javascript is vague to me,
Thanks for any help. Joe

BTW: this tool is just a basic cookied testbed
http://web2jo.com/Testing/MemoBed.html
 
C

clintonG

I didn't test the code with the WebTV emulator so that will be up to you
okay?
You will also have to modify the code to loop through the collection of
cookies to get the count and so on and do whatever it is you need to do.
Have a good time...

function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length; // total cookie count
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieValue (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}


--
<%= Clinton Gallagher
METROmilwaukee "Regional Information Services"
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/


This is not a a PC question but just a javascript one, this script is
used on webtv.
The cookie on this script can be split into 3 different memory's, what
I am trying to do is to be able to call up a total cookie count of all 3
memory's, so far I can get the count of only one at a time.
I am not a real time scripter so some javascript is vague to me,
Thanks for any help. Joe

BTW: this tool is just a basic cookied testbed
http://web2jo.com/Testing/MemoBed.html
 
P

Papajo

Thanks for your responce, I'll work on that script.

I came up with this but I think it's giving you the total cookie count
for your domain, well thanks again, Joe

<input type="button" value="Cookie Count" onClick="alert('Cookie
Count='+document.cookie.length+'')">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,266
Latest member
DavidaAlla

Latest Threads

Top