WMLScript Developer's Guide

[Cover] [Previous Section] [Next Section] [Index]

Current chapter: Chapter 8 - Calling WMLScript Functions from WML
Section 47 out of 57 total sections , Section 6 out of 6 sections in this chapter


Receiving Variables from a WMLScript

As shown in the preceding example, some actions have a direct effect on the UP.Browser and do not require the WML file that called the external WMLScript function to do anything more. When a WMLScript function returns a variable value to any WML file, the WML must retrieve the new value from the UP.Browser.

This code snippet from the preceding example returns the variable "image" with a value of "newimage.bmp" to the WML that made the initial function call.

    if (action == "reset") {  
    //set the value of the variable "image" to a BMP file  
        WMLBrowser.setVar("image", "newimage.bmp");  
    }  

In response, the WML file must include a line like the one below to retrieve the returned value:

<p align="center"><img alt="New Image" src="$(image)"/></p>  

The relevant part of this example is the WML img element and in particular: src="$(image)"/

This element tells the UP.Browser to retrieve the image source file from the variable image.


[Cover] [Previous Section] [Next Section] [Index]


Part Number DKDS-41-002, UP.SDK Release 4.1, December 2000

Copyright © 1994-2000 Openwave Systems Inc. All rights reserved.
Please send comments and questions to sdk-doc-comments@openwave.com.