Alex Rivera | Logout

Is it possible to manipulate an SVG document embedded in an HTML doc with JavaScript?

Asked 2008-09-26T08:32:03.240
22

I have made a SVG image, or more like mini application, for viewing graphs of data. I want to include this in a HTML page, and call methods on the SVG image.

Example:

<object id="img" data="image.svg" width="500" height="300"/>
<script>document.getElementById("img").addData([1,23,4]);</script>

Is it at all possible to call methods on the SVG document? If so, how do I declare the methods to expose in the SVG file, and how do I call them from the HTML document?

Edit
Report

2 Answers

5

I would reference Dr. David Dailey as the most awesome SVG / JS info you will find http://srufaculty.sru.edu/david.dailey/svg/

answered 2008-11-03T02:12:47.507
0

For support in IE6, have a look at SVGWeb.

There are examples on how to manipulate SVG with JavaScript in the sample code supplied with the library.

There is also a fair amount of information in the archives of the mailing list.

answered 2010-10-10T10:40:06.287

Your Answer