Interactivity

These days on the Web, all the bells and whistles in the world don't matter if the user doesn't feel that he or she can control it somehow. The Internet has gone interactivity crazy. Well, SVG is no slouch in the interactivity department. Interactivity is possible using SVG alone or with scripting.

Linking

The simplest form of interactivity is the hyperlink. SVG provides this capability in the form of the <a> element (like the HTML <a> element). In SVG, use the <a> element with the xlink:href attribute to establish a link on an object. The linked object is nested within the <a> element. Example 9-10 shows an ellipse (with text saying click here) that contains a link to the animated gradient (animateGradient.svg) document that we created in the previous section.