Basic usage and forms of ASP learning----

Source: Internet
Author: User
Tags script tag

ASP notation:

Notation 1:<%= "Hello world!" %>

Notation 2:<%

Response.Write ("Hello world!")

%>


ASP declaring variables: Using Dim

As follows:

<body>

<%

Dim name

Name = "Xiaohong"

Response.Write ("Your name is:" +name & "<br/>")

%>

</body>


ASP declaration Array: Dim arrayname (Arraylength)

<body>

<%

Dim names (3), I

Names (0) = "Zero"

Names (1) = "One"

Names (2) = "both"

Names (3) = "three"

For I=0 to 3

Response.Write ("Names is:" +names (i) & "<br/>")

Next

%>


ASP uses loops:

<body>

<%

Dim j

For J=1 to 6

Response.Write ("

Next

%>


ASP uses JavaScript scripts:

The first thing to write is the head:<%@ language= "javascript"%>

Using JavaScript, you can not use the relevant syntax of ASP, you should use JavaScript syntax

And JavaScript is to be case-sensitive

<%@ language= "JavaScript"%>

Note: Using the <%@ language= "JavaScript"%>, you can only use JavaScript syntax rules


Calling JavaScript-written functions

Write JavaScript functions in the head section: <% function%>

Write the call statement in the body section

As follows:

<%@ language= "javascript"%>


Two: To describe language as JavaScript in the script tag

runat= "Server"

Note: In this way, you can write JavaScript code that uses the syntax of ASP in the body


ASP processing forms:

Note: The HTML file is opened from IIS and the index.html file is placed at the top of the default file.

the value of the action is: ASP file

The value of method has get and post

If you use GET, use Request.QueryString (formname) to get the value

If you use post, use Request.Form (formname) to get the value

For example:

HTML file:

ASP Files:


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.