WMLScript » WMLBrowser » WMLBrowser.getVar

Syntax:
WMLBrowser.getVar(name)
name
The mandatory name parameter is the name of the variable.

Returns the value of the named variable.

The WMLBrowser.getVar function returns the value of the named variable.

If the variable does not exist, the empty string "" will be returned. If the syntax (spelling) of the name is wrong, invalid will be returned.

Examples

Code:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.WAPforum.org/DTD/wml_1.1.xml">
<wml>

<card id="card1">
   <p>
   getVar example
   </p>
   <do type="accept">
      <go href="GetVarExample.wmls#findgetvar()" />
   </do>
</card>

<card id="card2">
<p>
   load string = $(str);
</p>
</card>

</wml>
Explanation:

Code for GetVarExample.wml

Language(s): WML
Code:
extern function findgetvar()
{
   var val = Dialogs.prompt("Enter any value", "");
   var valu = WMLBrowser.getVar(val);
   var str = "The value is " + WMLBrowser.getVar("val");
   WMLBrowser.setVar("strng", str);
   WMLBrowser.go("GetVarExample.wml#card2");
};
Explanation:

Code for GetVarExample.wmls

Language(s): WML

See Also: