Obtain the cookie value

Source: Internet
Author: User

Function getCookie (name ){
Var Found = false
Var start, end
Var I = 0

// Cookie.
While (I <= document. cookie. length ){
Start = I
End = start + name. length
// Name brace old eggplant Lei Ah happy to rest
If (document. cookie. substring (start, end) = name ){
Found = true
I ++


// Name just Kai-ji cookies
If (Found = true ){
Start = end + 1
End = document. cookie. indexOf (";", start)
// Fu Xiaofu heboxlao Chuo Bao Langu solid (Fu Xiaofu Junyu ";" Ah, no)
If (end <start)
End = document. cookie. length
// Name value.
Return document. cookie. substring (start, end)
// Growth tumor promotes the rest of the system
Return ""

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.