15. WMLScript WMLBrowser Standard Library
WMLScript's WMLBrowser standard library contains seven functions in total. They are used to control the WML browser or to get information from it.
15.1. Going Forwards / Backwards to WML Cards: go() and prev() Functions
The go() function and the prev() function of the WMLBrowser standard library are used to go forwards and backwards to WML cards respectively. The syntax of go() is as follows:
WMLBrowser.go(url);
url is the URL of the WML card to go to. For example:
WMLBrowser.go("wmlscript_tutorial.wml");
The prev() function does not take any parameters. Its syntax is like this:
WMLBrowser.prev();
Both go() and prev() return an empty string if everything works fine. They return an invalid value if errors occur.
Note that the WML browser will load the target card only when it takes back control from the WMLScript interpreter.
Suppose a script calls go() or prev() multiple times before the WML browser takes back control. When the WML browser resumes control, it will only load the card specified by the last call. For example, let's say you call the following script from a WML card:
extern
function
example_func1()
{
WMLBrowser.go("wml_tutorial.wml");
WMLBrowser.go("wmlscript_tutorial.wml");
}
When the WML browser receives control, it will load the WML document wmlscript_tutorial.wml specified in the last statement.
Here is another example:
extern
function
example_func2()
{
WMLBrowser.go("wml_tutorial.wml");
WMLBrowser.go("wmlscript_tutorial.wml");
WMLBrowser.prev();
}
When the WML browser receives control, it will go to the previous card.
If the script to be called is like this:
extern
function
example_func3()
{
WMLBrowser.prev();
WMLBrowser.prev();
}
The WML browser will go backward once, but not twice, when it takes back control from the WMLScript interpreter.
Previous Page | Page 31 of 71 | Next Page |
- 1. WMLScript Introduction
- 2. Hello World WMLScript Example
- 3. Compiling WMLScript Code
- 4. WMLScript Language Rules
- 5. Defining WMLScript Functions
- 6. Calling WMLScript Functions
- 7. WMLScript Variables
- 8. WMLScript Data Types
- 9. WMLScript Variables Vs WML Variables
- 10. Passing Arguments to Functions By Value and By Reference
- 11. WMLScript Operators
- 12. WMLScript Conditional Statements
- 13. WMLScript Looping Statements
- 14. WMLScript Standard Libraries Overview
- 15. WMLScript WMLBrowser Standard Library
- 16. WMLScript Dialogs Standard Library
- 17. WMLScript String Standard Library
- 18. WMLScript Float Standard Library
- 19. WMLScript Lang Standard Library
- 20. WMLScript URL Standard Library
- 21. WMLScript Example: Validating Form Data