JS uses spaces and IFRAME prompts to perform background operations, accumulate the cookie storage value, and adjust the expiration time.

Source: Internet
Author: User
JS space Removal
String. Prototype. Trim = function () {return this. Replace (/(^ \ s *) | (\ s * $)/g ,"");

IFRAME prompt-processing: 1 <TD align = "right" colspan = "2" valign = top> <a href = 'productsave. aspx? Id = <% # databinder. eval (container, "dataitem. productcode ") %> 'target =" producturl "> </a> </TD>
2
3 <IFRAME id = "producturl" width = "0" Height = "0" name = "producturl" src = "" frameborder = "0"
4 scrolling = "no"> </iframe>

Cookie operation: 1 If (request. querystring ["ID"]! = NULL & request. querystring ["ID"]. tostring ()! = "")
2 {
3 string procode = string. empty;
4 // obtain the product ID
5 procode = request. querystring ["ID"]. tostring ();
6 string cookiea = string. empty;
7 // obtain the product favorites cookies saved on the local machine
8 If (request. Cookies ["productcode"] = NULL)
9 {
10 // write the product number cookie added to the local favorites
11 response. Cookies ["productcode"]. value = cookiea + "'" + "" + procode. tostring () + "" + "'" + ",";
12}
13 else
14 {
15 cookiea = request. Cookies ["productcode"]. value;
16 // write the product number cookie added to the local favorites
17 response. Cookies ["productcode"]. value = cookiea + "'" + "" + procode. tostring () + "" + "'" + ",";
18}
19
20 // set the expiration time of the product number cookie added to favorites on the local machine
21 response. Cookies ["productcode"]. expires = datetime. Now. adddays (30 );
22
23}
24 else {
25 this. showmessage ("because the system is busy or your browser does not support cookies, please open the cookie in your browser or try again next time! ");
26}

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.