The <script> element includes a block of client-side script. Each <script> element is executed in the scope of its containing element; i.e., it does not have its own scope. Variables defined in the <script> element are equivalent to variables defined using <var> within the same scope.
<script src="URI" charset="Encoding" fetchhint="prefetch" | "safe" fetchtimeout="time_interval" maxage="time_interval" maxstale="time_interval"> Script Text </script>
| src | The src attribute is the URI specifying the location of the external script. This attribute is optional. |
| charset | The charset attribute is character encoding if external script is used. This attribute is optional. |
| fetchtimeout | The fetchtimeout attribute is the time interval to wait for audio file to be fetched before playing the alternate content. This attribute is optional. |
| fetchhint | The fetchhint defines when the audio file should be retrieved. This attribute is optional. * prefetch – the audio file may be downloaded when the page is loaded. * safe – the audio file loads only when needed. |
| maxage | The maxage attribute indicates the maximum time in seconds that this document will use this script file before fetching another copy. This attribute is optional. |
| maxstale | The maxstale attribute indicates the maximum time in seconds that this document will use a script file that has exceeded the maxage time. This attribute is optional. |
<block>, <catch>, <error>, <filled>, <form>, <help>, <if>, <menu>, <noinput>, <nomatch>, <vxml>
None.
None.
None.
<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
<script>
<![CDATA[
function alwaysTrue() {
// no need to escape the following less than sign
return 1 < 2;
}
]]>
</script>
<block>
<prompt>
Hello
</prompt>
<prompt cond="alwaysTrue">
I am always here
</prompt>
</block>
</vxml>
NOTE:
It is wise to put CDATA escapes around your scripts so you don't have to escape XML reserved characters (eg. <, >, &, etc).