Wml-links

提供:Dev Guides
移動先:案内検索

WML-リンク

WMLには、リンクを使用してさまざまなカードをリンクし、さまざまなカードをナビゲートするオプションがあります。

WMLリンクの作成に使用できる<anchor>と<a>の2つのWML要素があります。

WML <anchor>要素:

<anchor> …​ </anchor>タグペアは、アンカーリンクの作成に使用されます。 <go/>、<refresh>、または<prev/>と呼ばれる他のWML要素と一緒に使用されます。 これらの要素はタスク要素と呼ばれ、ユーザーがアンカーリンクを選択したときに何をするかをWAPブラウザに伝えます

<anchor> …​ </anchor>タグペア内に、タスクタグとともにテキストまたは画像を含めることができます。

<anchor>要素は、次の属性をサポートしています。

Attribute Value Description
title cdata Defines a text identifying the link
xml:lang language_code Sets the language used in the element
class class data Sets a class name for the element.
id element ID A unique ID for the element.

以下は、<anchor>要素の使用法を示す例です。

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

<wml>

<card title="Anchor Element">
<p>
   <anchor>
      <go href="nextpage.wml"/>
   </anchor>
</p>
<p>
   <anchor>
      <prev/>
   </anchor>
</p>
</card>

</wml>

これにより、次の結果が生成されます。

WAP例9

WML <a>要素:

<a> …​ </a>タグのペアを使用して、アンカーリンクを作成することもでき、常にリンクを作成する好ましい方法です。

テキストまたは画像を<a> …​ </a>タグで囲むことができます。

<a>要素は、次の属性をサポートしています。

Attribute Value Description
href URL Defines URL of the liked page
title cdata Defines a text identifying the link
xml:lang language_code Sets the language used in the element
class class data Sets a class name for the element.
id element ID A unique ID for the element.

以下は、<a>要素の使用法を示す例です。

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

<wml>

<card title="A Element">
<p> Link to Next Page:
   <a href="nextpage.wml">Next Page</a>
</p>
</card>

</wml>

これにより、次の結果が生成されます。

WAP例10