WML - onenterbackward Event

Advertisements


This event occurs when the user hits a card by normal backward navigational means. That is, user presses the Back key on a later card and arrives back at this card in the history stack.

Here is the syntax to define an event handler for onenterbackward event:

<onevent type="onenterbackward">
   A task to be performed.
</onevent>

Following is the example showing how onenterbackward event occurs whenever you try to go back from second card to first card and defined event handler takes you to card number three instead of card number 1. Copy and past this program and try to play with it to understand onenterbackward event type.

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
"http://www.wapforum.org/DTD/wml12.dtd">

<wml>
<card id="card1" title="Card 1">
<onevent type="onenterbackward">
  <go href="#card3"/>
</onevent>
<p>
  <anchor>
     <go href="#card2"/>
     Go to card 2
  </anchor>
</p>
</card>
<card id="card2" title="Card 2">
<p>
   <anchor>
   <prev/>
      Going backwards
   </anchor>
</p>
</card>
<card id="card3" title="Card 3">
<p>
Hello World!
</p>
</card>
</wml>

When you load this program, you will get the following screen:

WAP Exampple12

Now, press option Go to card 2 to go to the second card this will take you to the following screen:

WAP Exampple14

Now, you are on second page. Now, when you try to go back on card number, onenterbackward event is executed and it takes you on card number 3 instead of card number 2 and you see the following screen.

WAP Exampple15


Advertisements
Advertisements