O'Reilly logo

Sams Teach Yourself SVG in 24 Hours by Micah Laaker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Scripts in SVG

Just in case you're completely in the dark on Web scripting, a script is a program written in a scripting language (JavaScript, for example) that carries out some kind of task within a Web page or other document, such as an SVG document. Although we're focusing on JavaScript, there are other types of scripting languages in use these days, including Microsoft's VBScript (Visual Basic Script). Scripts of any sort are added to an SVG file using the script element. To identify the scripting language, such as “JavaScript,” you can add a type attribute with the appropriate value (the MIME type of the scripting language).

For instance, if you were inserting a JavaScript script, you would add the following code to your SVG document: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required