14. WMLScript Standard
is based on ECMAScript, which is the standardized version of
away in order to increase the efficiency of WMLScript. To keep
WMLScript sufficiently powerful, a number of standard libraries are
added to it. Functions in the WMLScript standard libraries can
perform tasks that cannot be easily implemented or are impossible to
be implemented by writing your own WMLScript code.
are six standard libraries totally. Here is an overview of them:
The WMLBrowser library provides a group of
functions to control the WML browser or to get information from it.
The Dialogs library contains functions for
displaying alert messages, confirmation messages and input boxes to
The String library provides a number of functions
that help us manipulate strings.
The Float library contains functions that help us
perform floating-point arithmetic operations.
The Lang library provides functions related to the
WMLScript language core. It contains functions for generating random
numbers, performing some arithmetic operations and dealing with data
The URL library contains functions that help us
WMLScript standard libraries are included in the WAP specification.
Hence, mobile devices that support WMLScript should also support
the WMLScript standard libraries. Note that the Float library is only
available on mobile devices that can perform floating-point
programmers should get familiar with the standard libraries. With
such knowledge, you can know whether a particular task can be done by
using the functions in the standard libraries. If the standard
libraries do not have the function you need, that means you have to
implement the function yourself or the task cannot be done with the
14.1. How to Call a
Function in the WMLScript Standard Libraries
a function in the WMLScript standard libraries is simple. It is the
same as calling your own function, except that you have to add the
library name and a dot character before the function name. This is
following WMLScript example demonstrates how to call the sqrt()
function of the Float standard library to calculate the square root
of a number:
In the following sections, we will introduce to you each of the standard libraries and provide an in depth coverage of the commonly used functions.
Feedback Form (ExpandCollapse)