value

Evaluates and returns an ECMAScript expression.

<value
expr = "ECMAScript_Expression"
/>

expr

Required. An ECMAScript expression evaluated and returned as text to the containing element.

The value element lets you insert the contents of a variable into an audio, log element, or prompt element. When used within an audio or prompt element, the text is converted to speech.

This example picks a random card suit, plays the name of the suit to the user and writes the value of the suit to the debug log.

<?xml version="1.0"?>
<vxml version="2.1"
 xmlns="http://www.w3.org/2001/vxml">
  <!-- declare an array of suits -->
  <var name="aSuits" expr="new Array('hearts', 'clubs', 'diamonds', 'spades')"/>

  <script>
  <![CDATA[
  // return the name of a suit
  function GetSuit()
  {
    var iSuit = Math.floor(Math.random()*aSuits.length);
    return aSuits[iSuit];
  }
  ]]>
  </script>

  <form id="get_suit">
    <block>
      <var name="suit" expr="GetSuit()" />
      The chosen suit is <value expr="suit" />
      <log>suit=<value expr="suit" /></log>
    </block>
  </form>
</vxml>

Community Additions

ADD
Show: