The use of Response objects in ASP tutorials

Source: Internet
Author: User
Tags variable client
response| Object | Tutorial |response 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. In addition, we can use <%= data or variable%> to output information, and its effect is equivalent to 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

 
      
       
  "<%@ language=jscript%>"
 
      


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 used a flag pair and marked the use of the JavaScript scripting language, Unlike an HTML document, the statement runat= "server" in the flag pair indicates 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 file code in the browser, and you will not see

 
        
          <script language= "JScript runat=" Ser Ver ">......</script> and <%......%> code section 
         


In addition to the" Write "function, response also has the" 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.



Related Article

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.