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.
<?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>Code for GetVarExample.wml
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");
};
Code for GetVarExample.wmls