CopyCode The Code is as follows: <%
Response. Cookies ("cookie1") ("key1") = "keyvalue2"
%>
<Script language = "JavaScript">
String. Prototype. Get = function (name ){
VaR Reg = new Regexp ("(^ | & | \\?) "+ Name +" = ([^ &] *) (& | $) "), R;
If (r = This. Match (REG ))
Return Unescape (R [2]);
Return NULL;
}
// Obtain and return the cookie value
// Case insensitive for cookiename
// Dfltvalue is the default Return Value
// Do not consider the subkey
Function requestcookies (cookiename)
{
VaR lowercookiename = cookiename. tolowercase ();
VaR cookiestr = Document. Cookie;
If (cookiestr = "") Return "";
VaR cookiearr = cookiestr. Split (";");
VaR Pos =-1;
For (VAR I = 0; I <cookiearr. length; I ++ ){
Pos = cookiearr [I]. indexof ("= ");
If (Pos> 0 ){
If (cookiearr [I]. substring (0, POS). tolowercase () = lowercookiename)
{
Return Unescape (cookiearr [I]. substring (Pos + 1, cookiearr [I]. Length ));
}
}
}
Return "";
}
Document. Write ("read cookies named AB..." + requestcookies ("cookie1"). Get ("key1 "));
-->
</SCRIPT>