# \<script>

## \<script> <a href="#script" id="script"></a>

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

### Attributes

<table><thead><tr><th width="174.33333333333331">Name</th><th width="157">Data type<select><option value="811ebf03f88f44d1911debb146162058" label="String" color="blue"></option><option value="9d63cfa082474e288f934bd250f0fdb6" label="Integer" color="blue"></option><option value="d05218ef8a7d4639a31efe954db64b1e" label="Boolean" color="blue"></option></select></th><th>Description</th></tr></thead><tbody><tr><td>src</td><td><span data-option="811ebf03f88f44d1911debb146162058">String</span></td><td>The URI specifying the location of the script, if it is external.</td></tr><tr><td>srcexpr</td><td><span data-option="811ebf03f88f44d1911debb146162058">String</span></td><td>Dynamically determine the URI to fetch by evaluating this ECMAScript expression.</td></tr><tr><td>charset</td><td><span data-option="811ebf03f88f44d1911debb146162058">String</span></td><td>(defaults to “UTF-8”) The character encoding of the script designated by src.</td></tr><tr><td>fetchhint</td><td></td><td>This attribute is not supported.</td></tr><tr><td>fetchtimeout</td><td><span data-option="811ebf03f88f44d1911debb146162058">String</span></td><td>(defaults to “fetchtimeout” global property value) The timeout for fetches. Must be specified with the appropriate time units (e.g., “120s” for 120 seconds).</td></tr><tr><td>maxage</td><td><span data-option="811ebf03f88f44d1911debb146162058">String</span></td><td>(defaults to “scriptmaxage” global property value) Tells the platform the maximum acceptable age, in seconds, of cached scripts.</td></tr><tr><td>maxstale</td><td><span data-option="811ebf03f88f44d1911debb146162058">String</span></td><td>(defaults to “scriptmaxstale” global property value) Tells the platform the maximum acceptable staleness, in seconds, of expired cached scripts.</td></tr></tbody></table>

### 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

```markup
<?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>](https://docs.plumvoice.com/dev/voicexml/tags/block-tag), [\<catch>](https://docs.plumvoice.com/dev/voicexml/tags/catch-tag), [\<error>](https://docs.plumvoice.com/dev/voicexml/tags/error-tag), [\<filled>](https://docs.plumvoice.com/dev/voicexml/tags/filled-tag), [\<foreach>](https://docs.plumvoice.com/dev/voicexml/tags/foreach-tag), [\<form>](https://docs.plumvoice.com/dev/voicexml/tags/form-tag), [\<help>](https://docs.plumvoice.com/dev/voicexml/tags/help-tag), [\<if>](https://docs.plumvoice.com/dev/voicexml/tags/if-tag), [\<noinput>](https://docs.plumvoice.com/dev/voicexml/tags/noinput-tag), [\<nomatch>](https://docs.plumvoice.com/dev/voicexml/tags/nomatch-tag), [\<vxml>](https://docs.plumvoice.com/dev/voicexml/tags/vxml-tag)
