How to use:
1. Storing cookies
2, Parameter Description: 1, parameter 1:cookie store name, parameter 2:cookie the value to store
3. Examples are as follows:
Setcookie (' method ', match);
1. Get cookies
2, Parameter Description: 1, parameter 1:cookie store name
3. Examples are as follows:
GetCookie (' method ')
1, delete cookies
2, Parameter Description: 1, parameter 1:cookie store name
3. Examples are as follows:
Deletecookie (' method ');
The functions are as follows:
Copy Code code as follows:
<script language=javascript>
/**//************************************************************************
| Function Name: Setcookie |
| function function: Set cookie function |
| Entry parameters: Name:cookie name; Value:cookie value |
| Maintenance Record: Spark (Create) |
| All rights reserved: (C) 2006-2007 Beijing Oriental Changzhi Technology Co., Ltd. |
| Written Date: September 13, 2007 21:00 |
*************************************************************************/
function Setcookie (name, value)
... {
var argv = setcookie.arguments;
var argc = setCookie.arguments.length;
var expires = (argc > 2)? ARGV[2]: null;
if (expires!=null)
... {
var largeexpdate = new Date ();
Largeexpdate.settime (Largeexpdate.gettime () + (expires*1000*3600*24));
}
Document.cookie = name + "=" + Escape (value) + ((expires = null)? "" : ("; Expires= "+largeexpdate.togmtstring ()));
}
/**//************************************************************************
| Function Name: GetCookie |
| function function: Read Cookie function |
| Entry parameters: Name:cookie name |
| Maintenance Record: Spark (Create) |
| All rights reserved: (C) 2006-2007 Beijing Oriental Changzhi Technology Co., Ltd. |
| Written Date: September 13, 2007 21:02 |
*************************************************************************/
function GetCookie (Name)
... {
var search = Name + "="
if (Document.cookie.length > 0)
... {
offset = document.cookie.indexOf (search)
if (offset!=-1)
... {
Offset + = Search.length
End = Document.cookie.indexOf (";", offset)
if (end = = 1) end = Document.cookie.length
return unescape (offset, end) (document.cookie.substring)
}
else return ""
}
}
/**//************************************************************************
| Function Name: Deletecookie |
| function function: Delete Cookie function |
| Entry parameters: Name:cookie name |
| Maintenance Record: Spark (Create) |
| All rights reserved: (C) 2006-2007 Beijing Oriental Changzhi Technology Co., Ltd. |
| Written Date: September 15, 2007 18:10 |
*************************************************************************/
function Deletecookie (name)
... {
var expdate = new Date ();
Expdate.settime (Expdate.gettime ()-(86400 * 1000 * 1));
Setcookie (Name, "", expdate);
}
</script>