Mutual transfer of ASP JavaScript values

Source: Internet
Author: User

If you can understand the following sentence well, it is no problem.
ASP is a server-side language, and its function is to dynamically generate html css JavaScript that can be recognized by the client browser...
So how does ASP pass the value to JS?
Just generate JS dynamically ~~ How do we generate HTML?
Isn't that true?
Program Code
<Table>
<% Do while not Rs. EOF %>
<Tr> <TD>
<A href = <% = RS ("ID") %> <% = RS ("name") %> </a>
</TD> </tr>
<% Rs. movenext
Loop %>
</Table>
How to generate the name value? <% = RS ("name") %> how to generate the value in JS?
For example, a JS variable js_name needs to get the value of asp_name in ASP.
Generate
<SCRIPT>
Js_name = <% = asp_name %>
</SCRIPT>
It is no different from generating html. Similarly,
CSS can also generate VBScript VML or even XML, which can be dynamically generated. It is no different from HTML generation.
If you understand the above, it is okay to pass ASP values to Js.
The following describes how to pass the JS value to ASP.
How does one pass HTML values to ASP? Two common methods are form submission and suffix followed by URL to pass values.
The same is true for Js. Form submits URL suffixes.
Example:
Form submission. Assign the JS variable to an input.
<SCRIPT>
Document. form1.inputx. value = js_name
</SCRIPT>
Then form1.submit () submits the form
Example:
URL-based value transfer,
<SCRIPT>
Window. Open ("www.blueidea.com/index.asp? Asp_name = "+ js_name)
</SCRIPT>
The same as HTML, because JS and HTML are client-side items.
Another method is to allow js-ASP to pass values to each other through cookies.
You can set a cookie in ASP-> A1 = 111
If you get the cookie value in JS, you can use the document. Cookie in JS to get all the cookie values.
Then, we can get the A1 value of 111 through proper interception.
Set a1 = 111 In JS, and the correct value of this cookie can be read in ASP.
Above:
It is also suitable for uploading values of ASP/JSP/PHP/... with the same JS/vbs language on all servers.

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.