response object:
Reponse is one of six objects in Asp. It represents the server-side response to the browser. There are 8 methods, 9 properties and a set of responses. In this lesson, we will focus on the method.
method:
In javascript, the asp method uses parentheses. Please note the two methods that depend on response.buffer, we will talk about them in the next lesson. Also, you should note addheader() and redirect(), as they must take precedence over write() execution.
All methods are described and demonstrated above. I will explain each method in detail below. I will take a little extra time to tell the two methods we used the most.
write() and redirect():
Below are two asp scripts for Lesson 6.
Below is script6a.asp; it is it carrying 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, 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 putting it in response.redirect(). However, response.write() cannot be executed before response.redirect(), otherwise an error will occur.
Shortcuts to write():
The solution to our title is to dig deeper into it. Please see the script below.
Using the shortcut above, we can output a javascript data type or an asp local data type at the same time. In the example above I just output the javascript value. I can also do it like the example below.
Pay attention to the usage of the equal sign. At the same time, please note that shortcuts can only be used for the same value at the same time. Shortcuts cannot be used for multiple variables, connections, etc. Also note that everything in the script is executed in a linear order. And this is not the case when you create the runat property.
Our next stop is the seventh lesson -- response attribute
The original text and example address of this section: http://aspjavascript.com/lesson05.asp
Original author: James Clark Translation: huahua Please indicate when reprinting