Java Reference
In-Depth Information
N OTE
Note the use of the <br/> tag at the end of each line to produce a line break. Instead
of supplying a <br></br> empty tag pair, XML allows you to simply place a / (forward
slash) character after the opening tag to signify an empty tag. This will work with any
valid XML tag.
Anchors
WML, like its distant cousin HTML, is built around the concept of hyperlinking to enable
rapid access to information. HTML programmers are no doubt familiar with the <a></a>
anchor tag pair and will be pleased to find that WML supports a similar mechanism.
Navigation is supported in WML by the <a></a> and <anchor></anchor> tags. The <a></a>
tag pair is analogous to its HTML counterpart in that it is useful for jumping to another card
within the current deck or an external URL:
<a href=”http://www.cellmania.com/”>Cellmania</a>
The <anchor></anchor> tag pair supports the same functionality but also offers addi-
tional capabilities. An <anchor></anchor> tag can contain one of several “action” ele-
ments: <go> , <prev> , or <refresh> . The <go></go> element, by default, performs exactly
the same as the previous <a></a> tag example. The <prev> tag specifies a link to return
to the card loaded just previously, and the <refresh> tag is used to refresh a value of a
WML variable.
User Input
WML also provides support for text entry (the <input> element) and list selection (the
<select> and <option> elements). This code snippet demonstrates a simple text input element
that stores a value in the zipcode variable:
Zip Code: <input type=”text” name=”zipcode”>
This code snippet demonstrates the use of a select list to present a set of options to a user:
<select name=”state” title=”State:”>
<option value=”AZ”>AZ</option>
<option value=”AL”>AL</option>
<option value=”AK”>AK</option>
</select>
Events
WML supports the concept of events through the <onevent> element. An event can be either
triggered by a user (such as selecting an item on a list) or by an application (such as a timer as
Search WWH ::




Custom Search