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


Feedback Form (ExpandCollapse)

What do you think about this web page?






(Optional) Please provide us more details. For example, suppose you select option 2 above, can you tell us specifically what information is missing? You can also suggest anything that can help us improve this web page.

(Optional) Your name:

(Optional) Your email address:

Please enter again to confirm:

Due to the amount of messages we received, we may not be able to reply to all messages.

A button for going back to the top of this page