Specifying Script Files
You can specify one or more external script files containing scripts to use with objects in a document that will be saved as an SVG file.
- Click the Specify Script Files
button on the Script tab of the Interactivity window.
- Click Add in the Specify Script Files dialog box.
- Click the Browse… button to find and select a script file (*.js). Click OK.
Ex) Script file content – a script which makes a message appear when an object is clicked
function ClickMessage()
{
alert(‘Click’);
} - Confirm that the selected script file appears in the Specify Script Files dialog box, and then click OK.
- Now you must specify a script for a document or object
- Select a document or object and specify the script.
If a script has more than one line in it, end each line with a semicolon (;).
When you save the document as an SVG file, you must save the SVG file in the same folder as the script file.