20. WML
Variables
A
major difference between WML and HTML is that WML has build-in
support of variables. You can assign a value to a variable or output
the value of a variable in WML without involving any scripting
languages. To use variables in HTML, a client-side scripting language
(e.g. JavaScript and VBScript) is required.
20.1. Setting Variable
Values in WML
In
WML, variables do not have to be declared explicitly. You can choose
a variable name you like and assign a value to it directly. If you
read a variable without assigning a value to it earlier, you will
obtain an empty string.
Variable
names in WML are case-sensitive. The first character of a variable
name must be a letter or an underscore. The rest of the characters
can be letters, numbers or underscores. Other characters, such as
punctuations, are not permitted.
All
variables are stored as string. They have a global scope, which means
once you have set the value of a variable, you can read it in any
cards and decks.
You
can set the value of a variable in the following ways:
Using
the <setvar/> tag
Using
data collection tags <select> and <input/>
Using
the setVar() function of WMLScript's WMLBrowser standard
library
Feedback Form ( ExpandCollapse)
|