ASP self-study summary [1]

Source: Internet
Author: User
Tags constant definition

<% @ Language = JScript %> identifies your aspCodeScript Language

In ASP, you can write VB or JS as you like.

Script Language: Both JavaScript and VBScript are scripting languages. If the identifier is <% @ Language = %>
The default scripting language for IIS.

Dim Public Private is used for variable declaration.
<% Dim I, K %> if it is not declared, it is implicitly declared by default.

Operator-Arithmetic Operator
-*/\ (Entire division) mod +-& (string connection)
Operator-comparison operator
= <> (Not equal) <> <=> =
Operator-comparison operator
Not and or (and or not)

If statement
<%
If a> 12 then
Response. Write "11111"
Else
Response. Write "2222"
End if
%>

For Loop
<%
For j = 1 to 10
Response. Write "me"
Next
%>

Now () Current Time

Constant definition: (const)
Number: const S = 6
String: const S = "GG"
Time: const #2009-01-12 #

Conditional statement (if... then... else select case)
<%
If a <5 then
Response. Write "111"
Elseif A <10 then
Response. Write "222"
Else
Response. Write "333"
End if
%>

<%
Dim
A = 10
Select case
Case 1, 2, 3, 4
Response. Write "1"
Case 5, 6, 7, 8
Response. Write "2"
Case 9,10
Response. Write "3"
%>

Loop statement
Do... loop condition is true Loop
The while... Wend condition is a true loop.
For... Next specifies the number of cycles
Foreach... next loop the array or set

First: equivalent to the while loop in C
<%
Do while
....
Loop
%>
The second type is equivalent to the do... while loop in C.
<%
Do
....
Loop while
%>
Example:
<%
Do while a <10
Response. Write "aaaa"
A = a + 1
Loop
%>

<%
For I = 1 to 10 Step 2 // Step 2
Response. Write "DDD <br>"
Next
%>

Process (function)
The difference between sub and function is that sub has no return value, while function has a return value.
Definition:
Sub ()
Msgbox "Haha"
End sub
Call call ()

Sub mm (A, B)
Msgbox (A & B)
End sub
Call a ("DD", "cc ")

<%
Function ()
....
End Function
%>

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.