This version illustrates how to update the SVG plot being displayed in
the second embeded element but using code entirely within this HTML
document.
The things of interest to note are
- we had to change the
id = "bob"
on the rect
element in updateOther1.svg to xml:id = "bob"
,
i.e. use the xml prefix. This is necessary to be able use
getElementById() from within Javascript code here, even though
we are asking the SVG document for the element.
- We need to explicitly set the event handlers on the rectangle
element in the first SVG document.
- The function we call in the event handler must be visible from
the SVG element and so must be qualified with
parent.
to refer to the parent document.
- We establish the event handlers when the images have been
loaded
by putting the Javascript into the body of this HTML document
(or using an onload handler within this HTML document).
This seems to work on Opera and not Firefox at present.
(Note, us type="image/svg+xml".)
Duncan Temple Lang
<duncan@wald.ucdavis.edu>
Last modified: Mon Nov 28 11:16:18 PST 2011