当前位置: 首页 > 网络学院 > XML相关教程 > WAP > WML 变量

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

WAP 中的 WML 变量


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

Variables
变量

When a user switches from card to card in a deck, we need to store data in variables. WML variables are case sensitive.
当用户在deck中换“card”时,需要把数据储存在变量里,WML变量是区分大小写的。

Specify a Variable with the Setvar Command
用Setvar命令指定变量

When someone executes a task (like go, prev, and refresh), the setvar element can be used to set a variable with a specified value.
当有人执行任务(像向后,向前,刷新)时,setvar元素可用于设置一个有指定值的变量

The following example will create a variable named i with a value of 500:
下面的例子会创建一个值为500的名为“i”的变量:

<setvar name="i" value="500"/>

The name and value attributes are required.
名称和置属性是必须被设置的。

Specify a Variable through an Input Element
通过Input元素指定一个变量

Variables can also be set through an input element (like input, select, option, etc.).
变量可以通过一个input(输入)元素设置(像设置输入,选择,选项,等等)

The following example will create a variable named schoolname:
下面的例子创建了名为schoolname的变量:

<card id="card1">
<select name="schoolname">
<option value="HTML">HTML Tutorial</option>
<option value="XML">XML Tutorial</option>
</select>
</card>

To use the variable we created in the example above:
使用在上述例子中创建的变量:

<card id="card2">
<p>You selected: $(schoolname)</p>
</card>

评论 (0) All

登陆 | 还没注册?