<script>

Allows the specification of a block of client-side scripting language code.

Syntax

<script
    charset = "CDATA"
    fetchtimeout = "CDATA"
    fetchhint = "{prefetch | safe}"
    maxage = "CDATA"
    maxstale = "CDATA"
    src = "URI"
    srcexpr = "CDATA"
/>

Attributes

Attribute

Data Type

Required?

Default

Description

charset

CDATA

no

NA

Character encoding of the script designated by the src attribute.

fetchtimeout

CDATA

no

NA

Time interval to wait for the content to be returned before throwing an error.badfetch event. Use s for seconds (for example, 1s) and ms for milliseconds (for example, 1ms).

fetchhint

 

no

NA

Specifies when the VoiceXML Interpreter context should retrieve content from the server. Valid values:

  • prefetch = Fetch the resource when the page is loaded.

  • safe = Fetch the resource when it is specifically called by the application.

maxage

CDATA

no

NA

Maximum acceptable age, in seconds, of a resource being fetched from the cache. Setting maxage to 0 means that a cached version is never considered fresh.

maxstale

CDATA

no

NA

Maximum acceptable staleness, in seconds, of the resource being fetched, if the fetched resource is cached and expired.

src

URI

no

NA

URI of the script file.

srcexpr

CDATA

no

NA

ECMAScript expression that evaluates to the URI of the script file.

Parents

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

Children

None.

Example

<?xml version="1.0"?>
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
    <script>
      
        var d = new Date();
        var hours = d.getHours();
        var minutes = d.getMinutes();
        var seconds = d.getSeconds();
       
    </script>
    <form>
        <block>
            The time is <value expr="hours"/> hours,
            <value expr="minutes"/> minutes, and
            <value expr="seconds"/> seconds.
        </block>
    </form>
</vxml>

See Also

<assign>, <var>