14. WML Events and the <onevent> Tag

WML supports events and it provides a tag pair, <onevent></onevent>, for handling events. You can specify an action to be taken whenever an event occurs. Four events are supported in WML.

  1. ontimer -- This event occurs when a timer expires.

  2. onenterbackward -- This event occurs when a user goes back to a card through the WAP browser's URL history.

  3. onenterforward -- This event occurs when a user goes to a card in the forward direction. For example, if a user goes to a card by entering its URL directly in the WAP browser, the onenterforward event will be triggered.

  4. onpick -- This event occurs when an item of a selection list is selected or deselected.

The <onevent></onevent> tags are used to create event handlers. Its usage takes the following form:


<onevent type="event_type">
  A single task to be done whenever the event occurs
</onevent>


Tasks that are allowed to be placed between the <onevent> and </onevent> tags include <go>, <prev> and <refresh>. You have seen the <go> and <prev> elements before. We will describe how to use the <refresh> element when we cover variables in this tutorial.


Previous Page Page 27 of 50 Next Page


A button for going back to the top of this page
OSZAR »