JavaScript ASP Tutorial Sixth lesson--Response Method _asp Foundation
Source: Internet
Author: User
Response object:
Reponse is one of six objects in ASP. It represents the server-side response to the browser. Response has 8 methods, 9 properties, and one set. In this lesson, we will focus on the method.
Method:
In JavaScript, the ASP method uses parentheses. Notice the two methods that depend on Response.Buffer, and we'll talk about them in the next lesson. The same should be noted for AddHeader () and redirect (), as they must take precedence over write () execution.
All the methods are described and demonstrated above. I'll cover each method in detail below. I'm going to spend a little extra time talking about the two ways we use the most.
Write () and redirect ():
Here are the two ASP scripts for lesson sixth.
Here is script6a.asp; it is shouldering the whole burden.
The above script perfectly demonstrates the use of write () and redirect (). Response.Write () is very similar to document.write (). Keep in mind that response is an ASP object, and write () is an ASP method.
Please note that I can encapsulate the Response.Write () statement into a JavaScript function. I can put this function before Response.Redirect (). However, Response.Write () does not take precedence over Response.Redirect (), otherwise an error is generated.
The short cut to write ():
The way to solve our title is to dig deeper into it. Take a look at the script below.
Using the shortcuts above, we can output either a JavaScript data type or an ASP local data type. In the example above I just output the JavaScript value. I can also do it like the following example.
Note the use of the equals sign. Also note that shortcuts can only be used for the same value at the same time. Multiple variables, connections, etc. can not use shortcuts. Also note that all content in the script is performed in a linear order. This is not the case when you create the runat attribute.
Our next stop is the seventh lesson.--response Properties
Original and example address of this section: http://aspjavascript.com/lesson05.asp
Original Author: James Clark translation: Huahua reprint Please specify
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.