Getting Started with asp: Understanding the several scripting languages used by ASP programs

Source: Internet
Author: User
Tags html tags html to text
Programs | scripts

In the browser by looking at the source code can not see the ASP source code, you can only see the output from the ASP file, and those are just pure HTML. This is because the script is already executing on the server before the result is sent back to the browser.

Instance:

Write text in ASP
<%response.write("Hello World!")%> </body>
Add HTML to Text
<%response.write(" <%response.write("<p style='color:#0000ff'>This text is styled with the style attribute!</p>")%> </body>

Basic ASP Syntax rules

Typically, ASP files also contain HTML tags, similar to HTML files. However, ASP files can also contain server-side scripts that are surrounded by <% and%>. Server scripts are executed on the server side and can contain legitimate expressions, declarations, or operators.

Write output to the browser

The Response.Write command is used to write output to the browser. The following example sends a text to the browser: "Hello World".

<%response.write("Hello World!")%> </body>

There is also a shorthand method for Response.Write commands. The following example is equivalent to the above example:

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

VBScript

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

<%response.write("Hello World!")%> </body>

The example above also writes the text "Hello world!" in the body part of the document.

Javascript

If you need to use JavaScript as the default scripting language for a particular page, you must insert a line of language settings at the top of the page:

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

Note: Unlike VBScript-JavaScript is case sensitive. So you need to use different uppercase and lowercase letters to write ASP code according to the needs of JavaScript.

Other scripting languages

The ASP's collaboration with VBScript and JScript is inherently original. If you need to write scripts in other languages, such as Perl, REXX, or Python, then you must install the appropriate footstep engine.

Important: Because scripts are executed on the server side, browsers that display ASP files do not need to support scripting at all.



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.