- WML - Home
- WML - Overview
- WML - Environment
- WML - Syntax
- WML - Elements
- WML - Comments
- WML - Variables
- WML - Formatting
- WML - Fonts
- WML - Images
- WML - Tables
- WML - Links
- WML - Tasks
- WML - Inputs
- WML - Submit Data
- WML - Server Scripts
- WML - Events
- WML - Timer
- WML - Template
- WML - DTD
- WML2 - Tutorial
- WML Tools
- WAP - Emulators
- WML - Validator
- WML Useful Resources
- WML - Quick Guide
- WML - Useful Resources
- WML - Discussion
WML <ontimer> Tag
The ontimer event is used to trigger an event after a given time period. Let's say you want to display a message after 5 seconds of loading a card then you can use this event to do so.
Here is the syntax to define an event handler for ontimer event:
<onevent type="ontimer"> A task to be performed. </onevent> <timer value="50"/>
Example:
Following is the example showing usage of ontimer event alongwith <onevent> element.
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
"http://www.wapforum.org/DTD/wml12.dtd">
<wml>
<card id="splash" title="splash">
<onevent type="ontimer">
<go href="#welcome"/>
</onevent>
<timer value="50"/>
<p>
<a href="#welcome">Enter</a>
</p>
</card>
<card id="welcome" title="Welcome">
<p>
Welcome to the main screen.
</p>
</card>
</wml>
When you load this program, it shows you the following screen:
If you do not select given Enter option then after 5 seconds you will be directed to Welcome page and following screen will be displayed automatically.
Advertisements