start page | rating of books | rating of authors | reviews | copyrights

Book HomeWeb Design in a NutshellSearch this book

32.4. WML Elements and Attributes

The following is a brief summary of the elements and attributes in the WML 1.2 Specification (the latest version as of this writing). Because it is new, not all browsers support the entire specification, so be sure to test your applications.

There are a few core attributes that can be used in nearly every element:

xml:lang

Specifies the language for the element.

id

Give the item a name that can be referred to later.

class

Specifies a class name for the element (so they can be grouped).

<a>

<a>...</a>

Specifies a link to another resource (a specific card or another .wml document).

Attributes

href=url

Required. Location of the resource.

title=text

A brief text description of the link.

accesskey=keypad key

Assigns a keypad key to the link.

<access>

<access/>

Specifies a domain name. Only documents (decks) originating from that domain name can access the current document. The <access> element is contained within <head> tags.

Attributes

domain=domain name

The domain that can access the card.

path=pathname

Sets a path within the domain.

<anchor>

<anchor>...</anchor>

Specifies a generic link to another resource. It can be used in conjunction with the <go> and <prev> elements.

Attributes

title=text

A brief text description of the link.

accesskey=keypad key

Assigns a keypad key to the link.

<b>

<b>...</b>

Specifies bold text.

<big>

<big>...</big>

Specifies text that is slightly larger than the default text.

<br>

<br/>

Indicates a line break within the flow of text.

<card>

<card>...</card>

The unit within the WML document that displays in the device. Cards are logical divisions of the application's functionality.

Attributes

title=text

A brief text description of the card. This may or may not be displayed by the device.

newcontext=true|false

When set to true, this attribute reinitializes the state of the browser, clearing the navigational history and any stored variables.

ordered=true|false

Indicates how the card content is organized. A value of true indicates the card is part of a group of elements that are handled in sequence; false indicates there is no natural order.

<do>

<do>...</do>

Describes an action within the current card, generally assigned to a softkey on the device. The action is indicated by the elements <go>, <prev>, <noop>, or <refresh> within the <do> element.

Attributes

type=accept|prev|help|reset|options|delete|unknown (or "")

Required. Describes the intended use for <do> element so the device can decide how to implement it.

label

Specifies a text label for the button or function.

optional=true|false

When set to true, the browser can ignore the element. The default is false (the element must not be ignored).

name

Gives the element a name.

<em>

<em>...</em>

Specifies emphasized text (display is browser-dependent).

<fieldset>

<fieldset>...</fieldset>

Defines logical sections within content. It is currently poorly supported.

Attributes

title=text

A brief text description of the section.

<go>

<go/>

Specifies a task that navigates to a resource (like a link). The xml:lang attribute is not allowed in this element.

Attributes

href=url

Required. Specifies the destination URL.

sendreferer=true|false

The default is false. When set to true, the browser needs to specify the location of the deck containing this task in the request to the server.

method=get|post

The HTTP request method (for form data). It must be either of the values get or post. The default is get.

enctype=encoding

The content type of the form. The default is application/x-www-form-urlencoded.

accept-charset=charset list

A list of character encodings used to process the form data.

<head>

<head>...</head>

Specifies an optional header for the document.

<i>

<i>...</i>

Specifies italic text.

<img>

<img/>

Inserts an image into the content flow.

Attributes

src=url

Required. The location of the image to be displayed.

alt=text

Provides alternative text to be displayed if the image is missing.

localsrc=local image name

Specifies a predefined icon from the built-in icon library.

align=top|middle|bottom

Defines how the image is displayed relative to the surrounding text baseline.

vspace=number

Holds a specified number of pixels clear above and below the image.

hspace=number

Holds a specified number of pixels space to the left and right of the image.

height=number

Specifies the height of the image in pixels.

width=number

Specifies the width of the image in pixels.

<input>

<input/>

Adds a text-entry field to the document.

Attributes

name=text

Required. The name of the variable that stores the user input.

type=text|password

Sets the type of text entry. The default text allows normal text entry; password hides the entered text from view by displaying stars or dots.

value=value

Provides a default value that displays when the element is loaded.

format=format

Specifies a format for the entered text to restrict text entry to specific alphanumeric patterns (such as dates or credit card numbers).

emptyok

Indicates that it is okay to leave the field empty.

size=number

The width, in characters, of the text entry field.

maxlength=number

Maximum length of the entered text (in characters).

tabindex=number

Sets the order in which the form elements are tabbed through.

title=text

Specifies a description of the text entry screen; the description may or may not be displayed by the browser.

accesskey=keypad key

Assigns a keypad key to the field for quick access.

<meta>

<meta/>

Provides information about the document; it is placed within the <head> element.

Attributes

http-equiv=name

Specifies the HTTP header name.

name=name

Specifies a name for the meta information.

forua=true|false

Specifies whether the meta data is intended for the user agent (the browser). If set to false, it must be removed before it reaches the browser.

content=text

Required. Specifies the property value.

scheme=text

Used to interpret the data value.

<noop>

<noop/>

Specifies that nothing should be done. Can disable functionality in the browser.

<onevent>

<onevent/>

Triggers an action based on a specified event.

Attributes

type=onenterbackward|onenterforward|ontimer

Required. Specifies the type of event that will trigger the task contained within the <onevent> element tags. The onenterbackward value specifies navigation through the browser's history; onenterforward specifies any navigation (except the back function); ontimer executes the action on timer expiration.

<option>

<option>...</option>

Specifies one selection within a <select> list.

Attributes

value=value

Provides an optional variable for the selection, for example, to store an abbreviated version of the full selection name.

title=text

Gives the selection a name.

onpick=card id

Specifies the id of a card to navigate to when the option is selected.

<optgroup>

<optgroup>...</optgroup>

Deliminates groups of <option>s within a <select> list.

Attributes

title=text

Gives the submenu a title.

<p>

<p>...</p>

Specifies a paragraph of text.

Attributes

align=left|center|right

Positions the text horizontally in the display.

mode=wrap|nowrap

Specifies the wrapping mode for the paragraph. nowrap causes the text to display on one line and may require horizontal scrolling.

<postfield>

<postfield/>

Specifies name-value pairs to send to the server.

Attributes

name=text

Required. Specifies the name for the pair.

value=value

Required. Specifies the variable (value) for the pair.

<prev>

<prev>...</prev> or<prev/>

Instructs the browser to go back in its history stack to the previously viewed card. The standard attribute xml:lang is not permitted in this element.

<refresh>

<refresh>...</refresh>

Specifies a refresh task, which updates the browser context (clears history and stored variables).

<select>

<select>...<select>

Indicates a list of options in a form. The <select> element contains some number of <option> elements and may also contain <optgroup>s.

Attributes

title=text

Specifies a title, which the browser may or may not display.

name=text

The name of the variable (the value is assigned when the user selects an option).

value=value

Allows a default value to be specified.

iname=value

Specifies a variable whose value will be the index value of the chosen option.

ivalue=index number

Specifies a default selection using the default option's index number.

multiple=true|false

Determines whether multiple options may be selected from the list. The default is false (only one selection permitted).

tabindex=number

Sets the order the select object appears as user tab through the fields.

<setvar>

<setvar/>

Specifies the name-value pair for a variable. If a variable already exists, it is overwritten. The <setvar> element may only be used within <refresh> and <go> tags.

Attributes

name=name

Required. Specifies the name of the variable.

value=number

Required. Specifies the value of the variable.

<small>

<small>...</small>

Specifies that enclosed text should be slightly smaller than the default text size.

<strong>

<strong>...</strong>

Indicates strongly emphasized text. How it is rendered is device-dependent.

<table>

<table>...</table>

Indicates the beginning and end of a table.

Attributes

title=text

Specifies the table's title, which the browser may or may not display.

align=alignment code

Specifies the horizontal alignment of cell content for the table. The value is a string of the characters L, C, and R (representing left, center, and right, respectively), one for each column in the table. So a table with four columns might be aligned using align="RLRC".

columns=number

Required. Specifies the number of columns in the table. This is a departure from table syntax in HTML.

<td>

<td>...</td>

Defines an individual cell in a table. The contents of the cell are placed within <td> container tags.

<template>

<template>...</template>

Specifies a template for all the cards in the deck, including <do> elements for softkey behaviors.

<timer>

<timer/>

Sets a timer that can be used to trigger events when it expires.

Attributes

name=name

The name of the timer referenced by the event handler.

value=value

Required. Sets the length of time in tenths of seconds.

<tr>

<tr>...</tr>

Indicates a row within a table. Its contents are some number of <td> elements (table cells). The xml:lang attribute is not associated with this element.

<u>

<u>...</u>

Specifies underlined text.

<wml>

<wml>...</wml>

Indicates the beginning and end of a deck. It is the root element of a WML document (deck).



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.