20. WML Variables

Preferences - Do not show ads

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:

  1. Using the <setvar/> tag

  2. Using data collection tags <select> and <input/>

  3. Using the setVar() function of WMLScript's WMLBrowser standard library

Previous Page Page 39 of 50 Next Page

Contents at a Glance (Click Here for Full Table of Contents)
Print this Web Page | | Back to Top

Feedback Form (Expand)

What do you think about this web page?

WML Tutorial Table of Contents WML Tutorial Contents at a Glance Preferences - Change Color Scheme Preferences - Do Not Show Ads Previous Page Next Page