Access cookie using client side JavaScript in IE

  • Thread starter Thread starter feng
  • Start date Start date
F

feng

Hi,

I am new on cookies, especially from the client side
JavaScript's perspective.

I need to use client side JavaScript to read cookies. Here
is the only line that I copied from my browser's cookie
file:

DBList
DB1=daf320&DB2=dev320&DB3=jme320&DB4=jsk320&DB5=lxx320&DB6=
ogear320&DB7=pca320&DB8=raz320&DB9=rvs320&DB10=shh320&DB11=
sjk320&ListCount=11&Selected=2
localhost/
1024
40257536
29622684
1516427088
29620672
*

What I want is simply to read the value of "DB3" which
is "jme320". I looked it up from books and online doc but
I still don't get it. Almost all instructions I found
keeps saying that, when parsing the cookie, I should look
for the charactor ";" as dilimitor. But, as you can see
from my cookie above, there is no ";" at all.

Am I looking at wrong resource (this is for Nescape, not
IE?), or am I missing somethings here? How do I get that
value of "DB3"?

Thanks
 
Visit the page. In your browser URL line, type

javascript:alert(document.cookie);

This will show your cookie as Javascript sees it. Ignore what's stored on
disk-- that's not important.

To use cookies in clientside script, use the document.cookie object.

--
Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top