Page value transfer, foreground background value transfer, frontend and backend call

Source: Internet
Author: User
I. There are about three forms of passing values between pages through JS

 

1 window. The value is passed by opener. The child page can obtain the window object of the parent page. Of course, the object value can be obtained. This method does not have the length limit for transferring values and cannot be cross-origin.

2. There is a limit on the length of the cookie value.

3. The value is also restricted, but cross-origin is supported.

 

Ii. ASP. NET page value transfer

 

1. Add "?" After the querystring variable (or URL) Address

2. Pass the session value. (Server)

3. Set applica values. (Global, the best example is the online access volume)

4. Cookies. (Client save)


5


Httpcontext, that is, server. Transfer (). Note the difference between it and redirect.

 

 

Iii. js access background variables (1 and 2 are used more)

 

1. Access <input id = "hidencontrol" type = "hidden" runat = "server"> through a hidden control on the page (note that runat = "server ")

2. <% = Object Name %> if the object is pubulic's

3. register the function "<script language = 'javascript '> value =" + variable name + "</SCRIPT>" to access the value.

 
Iv. Access JS variables in the background

1 is also hidden

2 cookie or session

5. js calls background Functions


1 Document. getelementbyid ("btn1"). Click ();

2 var F = "<% = function () %>"; alert (f );

 

Six backend calls JS

1. Register JS Functions

2 Use literal

 

 

 

 

 

 


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.