当前位置: 首页 > 网络学院 > XML相关教程 > WAP > <do>

WAP
WAP 介绍
WAP 基础知识
WML 格式化
WML 链接
WML Input
WML 任务
WML 计时器
WML 变量
WML 实例
Validate WML
WML 参考
WML 字符实体
WML DTD

WAP 中的 <do>


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 178 ::
收藏到网摘: n/a

The <do> tag can be used to activate a task when the user clicks on a word/phrase on the screen.
<do>标签的作用是:当用户在品目上点击一个单词或词组时激活一个任务。

A <do> tag can also be nested inside a <template> tag. The <do> tag will then apply to all cards in the deck.
<do>标签也可以嵌套在<template>标签中使用。此时,<do>标签将应用于平台中的所有卡片。

Syntax
语法

<do type="type">
..task..
</do>

Attributes
属性

属性 描述
type accept
prev
help
reset
options
delete
unknown
x-*
vnd.*
REQUIRED. Defines the type of the "do" element
必要参数。定义“do”元素的类型
label cdata Creates a label for the "do" element
创建“do”元素的标签
name nmtoken Defines a name for the "do" element
为“do”元素定义一个名称
optional true
false
If set to true, the browser ignores this element. If set to false, the browser does not ignore this element. Default is "false"
如果设置为true,浏览器将忽略该元素;如果设置为false,那么浏览器将不会忽略该元素。默认值是false
xml:lang language_code Sets the language used in the element
设置元素中所使用的语言
class cdata Sets a class name for the element. The class name is case sensitive. An element can be connected to multiple classes. Multiple class names within the class attribute are separated by white space
为元素设置一个类名称。类名称是字母大小写不敏感的。一个元素可以被连接到多个类中。类属性中的多个类名称是通过空白符进行分隔的
id id Sets a unique name for the element
为元素设置一个独立的名称

Examples
案例

The example below uses a <do> tag inside a <template> tag to add a "Back" link to each card:

下面这个案例通过在<template>标签中使用<do>标签向每个卡片中添加了一个“Back”连接:

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<template> <do name="back" type="prev" label="Back">
  <prev/> </do>
</template>
<card id="card1" title="Card 1">
<p> Hello World!
</p>
</card>
<card id="card2" title="Card 2">
<p> From W3Schools!
</p>
</card>
</wml>


Note
注意

If a single <card> contains multiple <do> elements of type="accept", and these <do> elements are not named, WML might fail to compile and no page is displayed.
如果一个单独的<card>包含多个type[类型]值为“accept”的<do>元素,并且这些<do>元素未指定,那么WML将编译失败并且不会显示任何页面。

This is caused because the default name when no name is specified is the element type, in this case accept.
出现这个问题的原因在于没有指定包含合理元素类型的元素名称。

评论 (0) All

登陆 | 还没注册?