Response object:
Reponse is one of the six objects in asp. It represents the server's response to the browser. Response has eight methods, nine attributes, and a set. In this lesson, we will focus on methods.
Method:
In javascript, asp methods use parentheses. Pay attention to the two methods dependent on response. buffer. We will talk about them in the next lesson. You should also note addheader () and redirect (), because they must take precedence over write () execution.
All methods are described and demonstrated above. Next I will detail each method. I will spend some extra time describing the two methods we use at most.
Write () and redirect ():
The following are two asp scripts for Lesson 6.
The following is script6a. asp; it is responsible for the entire burden.
The above script perfectly demonstrates the usage of write () and redirect. Response. write () is very similar to document. write. Remember that response is an asp object, while write () is an asp method.
Note that I can encapsulate the response. write () statement into a javascript function. I can put this function before response. redirect. However, response. write () cannot take precedence over response. redirect (). Otherwise, an error will occur.
Write () shortcut:
The solution to our title is to dig deep into it. See the following script.
Using the shortcut above, we can output a javascript data type or an asp local data type at the same time. In the above example, I only output javascript values. I can also do the same as in the following example.
Pay attention to the equal sign usage. Note that shortcuts can only be used for the same value at the same time. You cannot use shortcuts for multiple variables or connections. Note that all content in the script is executed in a linear order. This is not the case when you create the runat attribute.
Our next stop is Lesson 7 -- response attributes
Original article and example address: http://aspjavascript.com/lesson05.asp
Author: James Clark