Using the <setvar/>
Tag

Setting
a value to a variable using the <setvar/> tag is simple. The
<setvar/> tag has two attributes, name and value.
The name attribute defines the variable name and the value
attribute defines the variable value. The following WML code assigns
the value WML Tutorial to a variable called var1:

<setvar
name="var1" value="WML Tutorial"/>

The
<setvar/> tag should be enclosed in the following tags:
<go></go>, <prev></prev>,
<refresh></refresh>. For example, let's say you want to
assign a value to a variable when a user follows an anchor link to a
certain card, you should write something like this:

If
you want to assign a value to a variable when a user clicks an anchor
link but you do not want the WAP browser to leave the current card,
you need to use the <refresh> tag instead of the <go> or
<prev> tag. Here is a WML example that demonstrates how to use
the <refresh> tag:

If
you click the above anchor link, the value of the variable
last_tutorial will be set to
WML Tutorial. If the
variable last_tutorial
is shown in the current card, the WAP browser will refresh the card
so that the updated value of last_tutorial
will be displayed on the screen. (We will describe how to show a
variable's value in a card in the "Referring
to the Value of a Variable in WML"
section.)

To
initialize a variable without involving any user actions, use the
<setvar> element with an event such as onenterforward
and onenterbackward.
The following WML example demonstrates how to initialize a variable
when a card is loaded:

What do you think about this web page? It is very helpful. It is helpful, but some information I wanted is missing. It is not helpful. It has broken links. It has typos / grammatical mistakes. It has incorrect information. Others

(Optional) Please provide us more details. For example, suppose you select option 2 above, can you tell us specifically what information is missing? You can also suggest anything that can help us improve this web page.

(Optional) Your name:

(Optional) Your email address:

Due to the amount of messages we received, we may not be able to reply to all messages.