<script>

The <script> element allows the specification of a block of client-side scripting language code, and is analogous to the HTML <SCRIPT> element.

Attributes

src The URI specifying the location of the script, if it is external.
srcexpr Dynamically determine the URI to fetch by evaluating this ECMAScript expression.
charset (defaults to "UTF-8") The character encoding of the script designated by src.
fetchhint This attribute is not supported.
fetchtimeout (defaults to "fetchtimeout" global property value) The timeout for fetches. Must be specified with the appropriate time units (e.g., "120s" for 120 seconds).
maxage (defaults to "scriptmaxage" global property value) Tells the platform the maximum acceptable age, in seconds, of cached scripts.
maxstale (defaults to "scriptmaxstale" global property value) Tells the platform the maximum acceptable staleness, in seconds, of expired cached scripts.

Notes

It is advisable to place all script text between CDATA delimiters: "<![CDATA[" and "]]>". Alternatively, conditional ECMAScript expressions that use the "<" or ">" symbols can use the replacements "&lt" and "&gt", respectively.


Example

<?xml version="1.0"?>
<vxml version="2.0">
  <form>
    <script>
      test_var=1234;
    </script>
    <block>
      <prompt>
        The test variable is set to <value expr="test_var"/>.
      </prompt>
    </block>
  </form>
</vxml>

The output of the above script would be:

Computer: The test variable is set to twelve hundred thirty-four.



Child Tags

None



Parent Tags

<block>, <catch>, <error>, <filled>, <foreach>, <form>, <help>, <if>, <noinput>, <nomatch>, <vxml>