当前位置: 首页 > 网络学院 > XML相关教程 > WAP > WML 变量
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变量是区分大小写的。
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.
名称和置属性是必须被设置的。
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> |