11.1. Going to a Card in Another Deck

The offset of a URL informs the WAP browser which card of a certain deck should be shown. An offset begins with the # character. A card in a deck is identified by the id attribute value of the <card> tag. The offset of a URL should be the ID of the target card.

The following WML example illustrates how to go to a card in another deck. The WML document below contains the cards of the first deck.


(linksEg1.wml)

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

<wml>
  <card id="tutorial_tc" title="WML Tutorial">
    <p>
      Hello, welcome to our WML tutorial.<br/><br/>
      Table of Contents:<br/>

      <anchor>
        <go href="linksEg2.wml#tutorial_ch1"/>
        Chapter 1: WML Introduction
      </anchor><br/>

      <anchor>
        <go href="linksEg2.wml#tutorial_ch2"/>
        Chapter 2: WML Deck and Card
      </anchor><br/>

      <anchor>
        <go href="linksEg2.wml#tutorial_ch3"/>
        Chapter 3: WML Document Structure
      </anchor><br/>

      <anchor>
        <go href="linksEg2.wml#tutorial_ch4"/>
        Chapter 4: WML Generic Metadata
      </anchor><br/>
    </p>
  </card>
</wml>


The following WML document contains the cards of the second deck:


(linksEg2.wml)

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

<wml>
  <card id="tutorial_ch1" title="WML Tutorial Ch1">
    <p>
      <em>Chapter 1: WML Introduction</em><br/><br/>
      ...
    </p>
  </card>

  <card id="tutorial_ch2" title="WML Tutorial Ch2">
    <p>
      <em>Chapter 2: WML Deck and Card</em><br/><br/>
      ...
    </p>
  </card>

  <card id="tutorial_ch3" title="WML Tutorial Ch3">
    <p>
      <em>Chapter 3: WML Document Structure</em><br/><br/>
      ...
    </p>
  </card>

  <card id="tutorial_ch4" title="WML Tutorial Ch4">
    <p>
      <em>Chapter 4: WML Generic Metadata</em><br/><br/>
      ...
    </p>
  </card>
</wml>


If you view the first WML document in a WAP browser, you should see something like this:






Sony Ericsson T610








Sony Ericsson T68i





Nokia Mobile Browser 4.0


If you select an anchor link in the above card, the WAP browser will show a card of another deck. For example, if you select the "Chapter 2: WML Deck and Card" anchor link, the WAP browser will display the card of which the ID is "tutorial_ch2" in the linksEg2.wml file, and you will see something like this:



Sony Ericsson T610


Sony Ericsson T68i


Nokia Mobile Browser 4.0


If an anchor link's URL does not have the offset, WAP browsers will display the first card of the deck. For example, let's say you create an anchor link using the WML markup below:


<anchor>
  <go href="linksEg2.wml"/>
  Chapter 1: WML Introduction
</anchor>


If you select the above anchor link, the WAP browser will display the first card contained in the linksEg2.wml file, that is the card with "tutorial_ch1" as its ID.


Previous Page Page 17 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