Below
Code:
Copy codeThe Code is as follows: <script language = "JavaScript" type = "text/JavaScript">
Function setmycookie (name) // Main Parameter
{
$ Name = "thename ";
$ Namev = test. Num. value;
VaR date = new date ();
$ Livetime = 5*24*3600*1000;
Date. settime (date. gettime () + $ livetime );
Document. Cookie = Name + "=" + $ namev + "; expires =" + date. togmtstring ();
Document. Cookie = "uername = sasas; expires =" + date. togmtstring ();
</SCRIPT>
The usage is like this.
Setmycookie ('name'); in this way, a cookie named name is set under the domain name.
PHP is easier to read.Copy codeThe Code is as follows: <? PHP
$ STR = $ _ cookie ('name'); // The parameter in it is the name set above.
?>
Reposted from 5d happy blog
Below are some supplementary knowledge. For more information, see.
Set and read the JavaScript code of the cookie
Since we have not found a good set of operation function code for JS cookies, for better content, refer to the nextArticle.