How to call WMLScript

How to call WMLScript from WML pages

Please note that WMLScripts do not embed in WML pages. WML pages only contain references to the script URL.

In the following example, if you choose go label, the external script will redirect you to 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 in function calls 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.