Request| Object | Tutorial ASP mainly has five built-in (built-in) objects: Server, Request, Response, application, and session. Now we'll explain them by example. The first is the most commonly used response object.
Example 1 using response to output HTML documents in a Web page
You can enter the above code in FrontPage Editor, or WordPad, Notepad, and so on, and then save as example1.asp, and the file name can be otherwise, but the extension (or suffix) must be. ASP. The previous example uses the "write function" of the response object to send HTML code to the client's browser, and the browser on the client computer displays the following list:
· My name is Jack. · I am from America. · and I love.
|
In fact, these HTML code can be written directly in the ASP file, and do not have to use Response.Write to output, in general, variables or some of the data changed to use the Response.Write to output. Besides, we can also use
<%= data or variable%>To output the information, its function is equivalent to the Response.Write.
Example 2 using response and <%= data%> to output the results from 1 to 100 in a Web page
The above example does not indicate that the use of VB Script scripting language, because the ASP default is VB Script, if you want to use Java script, you can in the ASP's top line with the statement
Specified. Note that there must be a space between the symbol "@" and "LANGUAGE". Once you have indicated it, you can use JavaScript as you please. For example 2, we can use JavaScript to do this.
Example 3 uses JavaScript and <%= data to%> output from 1 to 100 in a Web page
In this case, we use a flag pair and indicate that the JavaScript scripting language, unlike the HTML document, indicates that the statement runat= "server" in this flag pair shows that the script is running on the server side, not the client's browser, and then interpreted. To prove this is simple, view the source code in the browser, and you will not see
<script LAN Guage= The Code section of the "JScript" runat= "Server" >......</script> and <%......%>
|
/table> In addition to the "Write" function, Response also has "End method": Response.End. It is used to end the output of a Web page and the running of server-side scripting programs. Readers can attempt to use this "End method" themselves. Okay, next tutorial we'll talk about the powerful request-for-build (built-in) object in ASP.