An WMLScript is the WAP corollary to JavaScript scripting language While
the JavaScript has since been coopted by the server tool vendors (including the Netscape
and the Microsoft), An WMLScript is the client-only scripting platform used in the
combination with the WML to provide a client side procedural logic.
A D V E R T I S E M E N T
Like an WML, WMLScript
is also compiled via the WAP gateway in a binary form to provide the intelligence to
the mobile clients.
The WMLScript Syntax
The following bullets do help to summarize the basic syntax of the language:
Smallest unit of the execution in WMLScript is the statement and each statement
should end with the semicolon (;).
An WMLScript is a case-sensitive.
The Comments can either be single-line (beginning with "//") or can be multi-line
(bracketed by" /* "and "*/"). This syntax is also identical to both languages C++ and Java.
The literal character string is defined as any sequence of zero's or can be more
characters enclosed within the double ("") or a single (�) quotes.
The Boolean literal values correspond to either true or false.
The New variables are declared using the keyword var (i.e. var x;)
WML Data Types
Following are the data types that are supported by the WML:
Boolean.
Integer
Floating-point
String
Invalid
WMLScript Standard Libraries
The WMLScript do provides six "pre-built" libraries. These libraries includes:
Lang - data type manipulation, the absolute value calculations, and the random
number generation.
Float - this library includes the sqrt(), the round(), and the pow().
String -this library includes length(), the charAt(), the find(), the replace(),
and finally the trim() function.
URL - A typical functions include the getPath(), the getReferer(), and the getHost()
function.
WMLBrowser - The commonly used functions in this library are next(), getCurrentCard(),
go(), prev() and the refresh() function.
Dialogs - This library contains the functions the prompt(), the confirm(), and the alert() function.