3.10. elseif

Element typeelseif
Attributescond
Parentsif
ChildrenNone.
DescriptionDeclares the beginning of an "else-if code block" within an if element. All elements within the if element after the elseif element but before the next elseif or else elements are executed only if the if element's cond attribute and all subsequent elseif elements' cond attributes all evaluate to false and the elseif element's cond attribute evaluates to true.

DTD

<!ELEMENT elseif EMPTY >
<!ATTLIST elseif 
  %if.attrs; >

Language model



Attributes

cond : expression

An ECMAScript expression. If it evaluates to true, the elements after the elseif and before the next elseif or else elements will be visited.

Children

None.

Examples

Example 3-12. If-elseif-else logic
<?xml version="1.0" encoding="iso-8859-1"?>
<vxml version="1.0">
  <form id="pick">
    <field name="select"><grammar>one|two|three</grammar>
      <prompt>Pick a number from one to three.</prompt>
      <filled><if cond="select=='one'">
                <prompt>Your selection was one.</prompt>
                <elseif cond="select=='two'"/>
                <prompt>Your selection was two.</prompt>
                <else/>
                <prompt>Your selection was three.</prompt>
              </if>
      </filled>
    </field>
  </form>
</vxml>

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.166.151