ASP experience talks, ASP's scripting language
VBS CRIPT is an ASP scripting language because the ASP script is executed on the server side, so only the server side supports VBS CRIPT. VBS CRIPT is a subset of Visual Basic, although the number of built-in functions that can be used, but also makes him very small, thereby improving portability. The important differences between them are: variable types and scope of action; Use some built-in functions; add some functions and objects; how to process errors; ways to make the wrong debugging.
Eg: s cript > 1 Code Convention: Sub-type Prefix Sample Boolean Brou BLNFOUND BYT BYTRASTERDATA DATE BYT BYTRASTERDATA DATE (TIME) DTM Double SNG SNG SNG STRING STR
2 Variables: Length can not exceed 255 characters; must be unique within the declared scope.
static arrays and dynamic arrays: For Example: Dim My_Array (10) For Example: Dim My_Array () ReDim My_Array (10)
3 Procedures and functions: process: for example: Function: for es:
data type: Variant is the only data type of VBS CRIPT, 13 seed types: EMPTY, NULL, BOOLEAN, BYTE, INTEGER, CURRENCY, Long, Single, Double, Date (Time), String, Object, Error
5 constant:
(Ii) VBS CRIPT's basic syntax: 1 operation: = not equal to <> less than <= Not less than> = Object reference comparison IS Non NOT and AND AND or OR x 等 EQV implicit IMP2 cycle statement: LOOP When the condition is true to end cycle WEND When the condition is true, NEXT specifies the number of cycles, repeats the statement using the counter in Each ... Next ... Repeat each element in each item in the collection
3 Conditional statement:
4 Object: Label Object:
= DITOM.ITEM ("name")
ERR object:
VBS Cript function: 1 Mathematical function: Anti-orthogonal cut ATN (NUM) Cosine COS (NUM) Sinusoidal SIN (NUM) Tan (NUM) Absolute ABS (NUM) Natural log (NUM) Random number RND () symbol SGN (NUM) Square root SQR (NUM) with E a bottom index exp (Num)
2 Format Transformation Function cbool (EXP) Transformation into Logical CCYTE (Exp) Transformation into single-by-zyntheal CDATE (EXP) Transformation into Date-type CDBL (EXP) Transformation into Double-Bander TextR (EXP) Transformation Transformation into an integer Cint (EXP) transformation into long integer CSNG (Exp) transformation into single-precision CSTR (Exp) transformation into string type Encord character 8 BaoVal (EXP) transforming into a number
3 String Operation Functions: C (S) INSTR (S1, S2) LTRIM (S) RTRIM (s) STRComp (S1, S2) TRING (LEN, CHAR) TRIM (s) ucase (s)
4 Time Date Functions: Date () Time () Now () Month (Date) Minute (Time) Day (Date) Second (Time) WeekDay (Date) 5 variant subtypes: IsArray (var) IsDate (var) IsEmpty (var) IsNull (var) IsNumber (var) IsObject (var) Vartype (var)
Second, ASP basic knowledge
The ASP file is a text file, which is the same as ASP. A ASP file mainly following three parts: 1 HTML tag <%> This is distinguished by server-side ASP scripts and other characters. % @ Language = VBS cript%> s cripe> Tag language It will be performed immediately (when the web page is loaded) ) 'Separate the QNAME string, then assign a array next response.write "
(Ii) Use SSI (Server-Side Include) 1 function: # config Specifies the format used by the error message / date and file size to return to the browser Application or a shell command and insert the output into the HTML page. # FlastMod Insert the file's modification date into the HTML page # fsize Insert the file size into the HTML page # include in the HTML or ASP page contains files 2 #include command (executed when the server is formatted page) | For Example <- - # include virture / file = path file!>:! <- # include file = "Sunday .html "-> 3 #EXEC instructions can be running programs can be: CGI programs, ASP applications, isapi applications. The path is the complete virtual path or URL The method of passing parameters to the application is here. The application name is followed by a question mark and a list of parameters connected by the plus sign, which can only be used in the HTML page, cannot be used in the ASP page. Parameter CGI is used to run an application, such as CGI script / asp Or ISAPI Application Parameter CMD Used to Run the shell command Format of error message / date / file size, etc. Errmsg parameters: % A a week in a week, such as: Monday 05/06/91 12:51:32% D a day (01 ~ 31)% h 24 hours format (00 ~ 23) % i 12 hours format (01 ~ 12)% J a day in one year (001 ~ 366 )% M month (01 ~ 12) % M minutes (00 ~ 59) % s seconds (00 ~ 59)% u one year A week, Sunday, as a week (00 ~ 51) One day in the week, Sunday is the first day (0 ~ 6)% w a week in a year, Monday begins as a week (00 ~ 51)% x local dates, such as: 05/06/91 Year, such as: 1996% z,% z time zone full name or abbreviation, if you don't know the time zone, there is no character. %% percent sign '
To kilobytes 6 .inc file include file three ASP objects (Request, Response, Server, Application, Session) five basic objects: Request Object Response Object Server Object Application Object Session Object When users use GET methods to transfer data when users use GET methods in Form The data submitted by the user is attached to the query string (QueryString), which is submitted to the server-side specified file. The role of the queryString collection is to read the data submitted by the user from the query string. can not use form as The input of the browser, can directly use the statement: the input tools): Browser: