At last, here’s the part that tells you how to actually get the browser to call all this WMLScript you’ve been writing!
A function to be called from WML must be declared
extern. However, there are no other restrictions
on it. It can have as many arguments as you like, and these arguments
can be of any type.
You call WMLScript from WML
by using a
task with a specially formatted
URL. The function to call and the arguments to pass are encoded into
the URL fragment (the part after the first
character). This fragment looks just like a normal WMLScript function
call. For example, a call to the function
test('foo') in the file referenced by the relative
test.wmlsc can be written as:
Note that this uses single quotes around the string
'foo'. It can be equally well written as:
It’s probably best to be consistent about using either single or double quotes around all your attribute values and then use the other kind around any strings in the embedded call to WMLScript. For example, I always put double quotes around attribute values, and then always use single quotes around embedded strings, just like the first form of the last call.
The following sections describe differences between how you embed a
WMLScript call in a
<go> task’s URL
and how you would write the call in WMLScript itself.
Because the call is embedded in ...