ASP Introductory Tutorial: ASP basic syntax

Source: Internet
Author: User

You cannot view the ASP source code Select "View Source file" in the browser, you will only see the output of ASP files, which are pure HTML. This is because the script executes the results on the server before it is sent back to the browser.

In our ASP tutorials, each example shows the hidden ASP source code. This will make it easier for you to understand how it works


<body>
<%
Response.Write ("%>

<%
Response.Write ("<p style= ' color: #0000ff ' >this text is styled with the style attribute!</p>")
%>
</body>

The output result is.

can use HTML tags to format the text!
This text was styled with the style attribute!

Basic grammar Rules
An ASP file usually contains HTML tags, just like an HTML file. However, ASP files can also contain server scripts, separating "% and%" around them. Server scripts are executed on the server and can contain any expressions, reports, programs, or operators that are valid scripting languages you like to use.

Inbox output to Browser
The Response.Write command is used to compose output to the browser. The following example sends the text of the "Hello World" browser:

<%
Response.Write ("Hello world!")
%>
</body>
   

There is also a shorthand method Response.Write order. The following example also sends the text of the "Hello World" browser:

<%= "Hello world!" %>
</body>
     

VBScript
You can use a variety of scripting languages in ASP. However, the default scripting language for VBScript:

<%
Response.Write ("Hello world!")
%>
</body>



--------------------------------------------------------------------------------

JavaScript
to set JavaScript as the default scripting language for a specific page, you must insert a page above the language specification:

 

 <%@ language= "javascript"%> <% Response.Write ("Hello World
!") %>  </body> 
   
 
         

Note: Different languages -j Avascript is case-sensitive. You will have to write your ASP code with uppercase and lowercase letters in the language when you need it. The




Other scripting languages
ASP is JavaScript and JScript (Microsoft's execution). If you want to be in another scripting language, such as Perl, REXX, or Python, you must install the scripting engine for them.

Important: Because executing scripts are on the server, browsers do not need to support all scripts to display ASP files!

 

Reprint please indicate from www.111cn.net

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.