| |

VerySource

 Forgot password?
 Register
Search
View: 10|Reply: 3

Ask a question about cookie reading

[Copy link]

1

Threads

2

Posts

3

Credits

Newbie

Rank: 1

Credits
3

 China

Post time: 2020-3-23 23:00:01
| Show all posts |Read mode
I wrote this in asp:
Response.Cookies ("cookie1") ("mm3") = "nickname"

So how to read ("cookie1") ("mm3") cookie value in javascript?


Asked here, I forgot to inform you.
Reply

Use magic Report

0

Threads

1

Posts

2

Credits

Newbie

Rank: 1

Credits
2

 China

Post time: 7 day(s) ago
| Show all posts
<script language="javascript">
      var strCookie=unescape(document.cookie);
      var strTT="cookie1=mm3=";
      if(strCookie.indexOf(strTT)>=0)
      {
            var strT1=strCookie.substring(strCookie.indexOf(strTT) + strTT.length)
            var strT2=strT1.substring(0,strT1.indexOf(";"))
            alert(strT2);
      }

</script>
Reply

Use magic Report

1

Threads

2

Posts

3

Credits

Newbie

Rank: 1

Credits
3

 United States

 Author| Post time: 6 day(s) ago
| Show all posts
But when there are multiple arrays, you can't read them. . .
eg:
Response.Cookies("cookie1")("mm3")= "nickname"
Response.Cookies("cookie1")("mm2")= "nicknamexxxx"

The above method will not work.
Reply

Use magic Report

0

Threads

2

Posts

3

Credits

Newbie

Rank: 1

Credits
3

 China

Post time: The day before yesterday 10:15
| Show all posts
Cookie is a string for javascript, cut it yourself~
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2020|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list