Basic statement. Note where you want to add ';' '. Empty statement: one; 2. Declaration of functions and calls 2.1 The following line statement is a simple example of defining functions: Function CurrencyConvert (currency, exchange) {return currency * Exchangerate;}; where the name of this function is currencyconverter, parameters have currency and ExchangeRate two The function code block contains a statement that returns the product of Currency and ExchangeRate. Below is an example of defining an external function using extern. The function name is textit, there is no parameters, and two assignment variables are defined in the function body, one hierarchical, one function value: Extern function test () {var usd = 10; var fim = currencyconverter (USD, 5.3)} 2.2 Call 2.2.1 The internal function can be called before it is defined, or it can be called after it is defined. For example, the following is an example called after the function definition. Function Test1 (VAL) {RETURN VAL * VAL;}; Function Test2 (Param) {Return Test1 (PARAM 1);}; 2.2.3 External Function Call Example: The internal function can be called before its definition, or it can be Call after definition. For example, the following is an example called after the function definition. Function Test1 (VAL) {Return Val * Val;}; Function Test2 (Param) {RETURN TEST1 (PARAM 1);}; 2.2.4 Library function: The internal function can be called before its definition, or after it defines it. transfer. For example, the following is an example called after the function definition. Function Test1 (VAL) {RETURN VAL * VAL;}; Function Test2 (param) {Return Test1 (param 1);}; 2.2.4.5 Nested call - not nonsense. Me.
3. Precatch 3.1 External file Use the URL address to locate a WML Script file. With this URL address; in WML Script program we can call the WML Script's external file, the declaration method of the external file precompiled header is the USE URL, the syntax format is as follows: USE URL external file name "URL" address In the programming of the current file, you can use the external file declared by the precompiled head, so that the function of the external file can be called. Its grammar format is: external file name # function name (parameter list); for example, I want to call the check () function in the Otherscript external file in the current WML Script program, and know the URL address of the Otherscript file is http: // www .host.com / App / Script. Therefore, you can use the USE URL to declare this external file: Use url taherscript "http:
//www.host.com/script "Subsequently, we can call the check () function in OtherScript in the program: Function Test (PAR1, PAR2) {Return Otherscript # Check (PAR1, PARR2);}; The execution process is as follows: (1) Locate the URL address of the WML Script external file; (2) Load an external file from the specified URL address value; (3) Detect the contents of the external file, and execute the CHECK () function. The URE URL Pre-Describe The specified external file name must be unique in the current program, the user cannot specify the same name external file of the different URL addresses, otherwise it will be chaotic when calling external files. In addition, the URL address in the USE URL precompiled It can also be relative URL addresses. The relative URL starting position is where the current program file is located, and the position is positioned according to the URL. If the character in the URL address contains an escape character, WML Script will be essential The escan is required. However, the program does not escape when compiled, but the validity of the URL format and URL addresses when the program is executed. 3.2 Access We can use access to access Compiling the contents of the protection file, implement access control. Wml Script programming, you must use the access preform before calling the external function. However, the default value of the WML Script Access Permissions check is not checked. DISABLED. However, access is declared, after the external function is called, the compiler checks the access rights of the external file to determine whether the file is authorized to use the file and its inner function. Access preamble The declaration method is the use access, the syntax format is as follows: Use Access Domain Operation Domain Name Path Operation Path: Access Preparation Header determines what kind of inspection work will be made by specifying the Domain and Path properties. If the file has Domain or PATH Attributes, then the URLs are consistent with the values in the properties. When compared, the domains and paths are compared in the URL uppercase rules. Specific comparison is the following: (1) The operation domain matches the domain suffix in the URL Matching with the suffix is that all subdomains must be consistent forward. For example, www.wapforum.org and WAPForum.org match, and does not match for Forum.org. (2) Operation path and URL The path prefix matches. The path prefix match is the value must be consistent from the previous one. For example: "/ x / y" and "/ x "Match, not" / xz "matches. (3) However, the provincial Domain number behavior current file domain is "/". However, in order to simplify programming, sometimes WMLScript does not need until the absolute path of external files, we only need to provide the relative URL of the file, the user browser execution program is the card relative path automatically converted to an absolute path, and matches the path properties.