Hoe WMLScript aanroepen
- Previous Page WMLScript Introduction
- Next Page WML Dialogs
Hoe WML-pagina's WMLScript aanroepen
Let op, WMLScripts worden niet geïntegreerd in WML-pagina's. WML-pagina's bevatten alleen verwijzingen naar de script URL.
In de volgende voorbeeld, als je go label kiest, zal de externe script je redirecteren naar http://www.codew3c.com/wmlscript/wap.wml:
<?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="no1" title="Go to URL">
<do type="options" label="Go">
<go href="check.wmls#go_url('W3School')"/>
</do>
</card>
</wml>
The blue code above contains references to WMLScript. The script is located in the file named check.wmls in the file, the function name is go_url.
This is the file named check.wmls WML page:
extern function go_url(the_url)
{
if (the_url=="W3School")
{
WMLBrowser.go("http://www.codew3c.com/wmlscript/wap.wml")
}
}
Please note the keywords used by the function externWhen using this keyword, the function can be called by other functions or events outside of the .wmls file. If the function is a private function, do not use the extern keyword.
- Previous Page WMLScript Introduction
- Next Page WML Dialogs