| Type: | Heading Tags |
|---|---|
| Attributes: | |
| See: | a input |
The script tag allows you to embed JavaScript into the document. The JavaScript is executed when the document is loaded by Acrobat, so this is generally a good place to declare functions and so on.
The XML syntax means that the <, > and & characters are "escaped" even within JavaScript - so you need to edit your scripts to use < > and & instead. A better alternative is to use the CDATA XML declaration to prevent the block from being parsed.
Here's a simple JavaScript function defined in the head of the document.
<pdf>
<head>
<script>
function min(x,y)
{
return (x < y ? x : y);
}
</script>
</head>
Here's the same function but using the CDATA declaration.
<pdf>
<head>
<script>
<![CDATA[
function min(x,y)
{
return (x < y ? x : y);
}
]]>
</script>