faqts : Computers : Internet : Web : SVG : ...with Javascript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

9 of 10 people (90%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

How do I include my Javascript functions in an SVG file?

Nov 15th, 2003 20:45
Jon Frost, http://svgfaq.com/JSGeneral.asp#4


Kevin Lindsey writes:
If your JavaScript is within the SVG document, then you'll need: 
<svg>
    <script><![CDATA[
    // JavaScript code here
    ]]></script>
</svg>
 
If your JavaScript is external to the SVG document, then you'll need: 
<svg>
    <script xlink:href="YourJavaScriptFile.js"/>
</svg>