The Document object has a cookie attribute that allows JavaScript code to persist data on the user's hard disk,and be able to get the data stored in this way. Client persistence is an easy way to give your Web application memory. cookies can also be used for client-side scripting and are a standard extension of the HTTP protocol. the string of a cookie consists o
This article mainly introduces how to implement javascript-based COOkie operations only once. For more information, see. I know that many people actually need this function when developing websites, it is to control the user's top point! So here I will briefly write about the javascript-based COOkie operations!
The
This article mainly introduces the JavaScript Cookie operation method. The example analyzes the related skills of javascript for cookie operations. For more information, see the example below. Share it with you for your reference. The details are as follows:
// My methods for setting, reading and deleting cookies.//
We already know that there is a cookie attribute in the document Object. But what is Cookie? "Some websites store some information on your hard disk with small text files, which are called cookies ." -- MSIE help. In general, Cookies are created by CGI or similar files and programs that are more advanced than HTML, but javascript also provides comprehensive acces
Use native js with cookie to create a save path drag and drop jscookie
It mainly uses native js to encapsulate a cookie, and then uses three events for drag and drop, respectivelyOnmousedown, onmousemove, onmouseup,Two of the three events need to add the event object, that is, event. The event object is incompatible, so you need to handle compatibility issues, th
Create a Cookie array based on PHP. Create: Copy the code as follows: setcookie (ICNet [Reg], thisregcookie, time () + 3600); setcookie (ICNet [Active], Thisislogincookie ., time () + 3600); print_r ($ _ COOKI
Create:
The code is as follows:
Setcookie ("ICNet [Reg]", "This is reg
This article provides a detailed analysis of how to create a Cookie array in PHP. For more information, see
This article provides a detailed analysis of how to create a Cookie array in PHP. For more information, see
Create:
The Code is as follows:
Setcookie ("I
During program development, cookies are rarely used, such as http://jb51.net/article/33590.htm. Used to be written as a Cookie set. What is called a Cookie set is a Cookie, which has multiple values. The following describes how to create and use a Cookie set.Copy codeThe Cod
JavaScript Settings Cookie
Set CookiesEach cookie is a name/value pair, and you can assign a string such as the following to Document.cookie:Document.cookie= "userid=828";If you want to store more than one name/value pair at a time, you can use a semicolon plus a space (; ) separated, for example:Document.cookie= "userid=828; Username=hulk ";You cannot use semic
This article mainly introduces how to obtain and delete JavaScript cookies. For more information, see
Set cookie
Each cookie is a name/value pair. You can assign the following string to document. cookie:
Document. cookie = "userId = 828 ";
To store multiple name/value pair
This article provides a detailed analysis of how to create a Cookie array in PHP. For more information, see
Create:
The code is as follows:
Setcookie ("ICNet [Reg]", "This is reg cookie", time () + 3600 );Setcookie ("ICNet [Active]", "This is login cookie.", time () + 36
This article describes how to use javascript to obtain the cookie expiration time. Because the cookie expiration time is controlled by the browser, you can only use the work und in this article to obtain the cookie expiration time, you can refer to the following javascript a
Some problems need to be treated with a cookie, just read the Rhino book about the introduction of cookies, put together some notes.A cookie is a small amount of data stored by a Web browser, and it is related to a specific Web page or site.The cookie data is automatically transferred between the Web browser and the Web server, so the server-side script can read
JavaScript data storage Cookie, javascriptcookie
1. What is cookie?A: cookies are used to store session information on the client.2. What are the components of cookies?① Name: a unique cookie name. It is recommended to be case sensitive. The cookie name must be URL encoded.②
Cookie Object
is a data message (cookie data) that is stored in the cookie folder of the client's hard disk in the form of a file (cookies file). User data information (cookie data) in the cookie folder. The cookie file is est
Javascript operations on cookie _ Get and modify code are improved with the previous method, and class methods are used.
The Code is as follows:
Function $ Cookie (){Var a = arguments. callee;Var B = a. _ cached;If (a. _ cached) {return a. _ cached}If (! (This instanceof a) {return new}If (typeof a. _ cached = "undefined") {a. _ cached = this}}$
Javascript Summary-cookie
Cookies in javascript can be used to save multiple pieces of information, and each item is stored in the following format: Information name = Information Content
The cookie contains some control fields, such as expires, which indicates the cookie ex
The cookie is not a limited only to Web browsers. Any http-aware client this supports cookie can deal with a cookie sending aSp. NET Web API. The following code example shows a class extended from WebClient. It overrides the virtual method getwebrequest to attach a instance of Cookiecontainer to the request. The Cookiecontainer object instance have to is reused a
= arguments[2]?arguments[2]:30; This cookie will be saved for 30 days
var exp=new date ();//new date ("December, 9998")
; Exp.settime (Exp.gettime () + days*86400000);
Document.cookie=name + "=" + Escape (value) + "expires=" + exp.togmtstring ();
}
Take cookies function
GetCookie (name) {
var arr=document.cookie.match (new RegExp (^|) +name+ "= ([^;] *)(;|$)"));
if (arr!=null) {return
unescape (arr[2]);
}
return null;
}
Delete
Processing cookies in JavaScript is complicated because of its well-known interface, namely the doucmentcookie attribute of BOM. This attribute is unique in that it will show different behaviors in different ways. When used to obtain the property value, documentcookie returns a result that processing cookies in JavaScript is complicated because of its well-known interface, namely the doucment.
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.