Accessing DOM elements in an embedded doc

J

Julius Mong

Dear all, I have something like this:

<html... >
<embed ...>
</html>

Am I out of luck if I wanted to access the embedded DOM and manipulate its
content?

Or if I have:

<svg ...>
<svg ...>
...
</svg ...>
</svg>

Is it possible to manipulate the inner svg elements from a script defined in
the outer? I tried

var SVGDoc = evt.getTarget().getOwnerDocument();
var SVGRoot = SVGDoc.getDocumentElement();
var SVGInner = SVGDoc.getElementsByTagName("svg");
SVGInner.currentTranslate.x += dx;

and it won't work, if I did:

var SVGDoc = evt.getTarget().getOwnerDocument();
var SVGRoot = SVGDoc.getDocumentElement();
SVGRoot.currentTranslate.x += dx;

then the entire outer document gets translated, I've also tried
SVGDoc.getElementByID and getfirstChild with no luck... can someone point me
in the right direction?

Thanks, Jules
 
J

Julius Mong

SVGDoc = document.embeds["svgPage"].getSVGDocument();
SVGRoot = SVGDoc.getDocumentElement();

An SVG embed in an HTML and then do whatever you want with the SVG :)
 
I

Ivo

SVGDoc = document.embeds["svgPage"].getSVGDocument();
SVGRoot = SVGDoc.getDocumentElement();

An SVG embed in an HTML and then do whatever you want with the
SVG :)

Excellent stuff.
Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top