By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,179 Members | 2,192 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,179 IT Pros & Developers. It's quick & easy.

Accessing DOM elements in an embedded doc

P: n/a
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

Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a


Julius Mong wrote:
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?
As browsers offer an <embed> element to embed content rendered by
plugins I am not sure what your example is, an attempt to provide a HTML
snippet which you script inside of a browser and where you then usually
be able to script the <embed> element if the plugin exposes an API to
JavaScript, or an attempt to define your own new element <embed> that is
supposed to embed on HTML document into another. If the latter I am
wondering why you do not use <iframe> or <object> as that are the tools
HTML 4 (or XHTML 1) provides to embed another HTML page. As for
accessing them, yes, inside of a browser and with the HTML DOM there are
properties, see
http://www.w3.org/TR/DOM-Level-2-HTM...ml#ID-67133006
http://www.w3.org/TR/DOM-Level-2-HTM...ml#ID-38538621
for contentDocument of an <iframe> or <object> element.

Of course if it is not inside of a browser and you are just using the
W3C DOM Core then it is diffifult. So you need to tell us how you are
going to use the DOM, with which language, which level and which modules
you have available.
Or if I have:

<svg ...>
<svg ...>
...
</svg ...>
Does SVG allow to nest <svg> elements? </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?


Do you know about the Yahoo group for SVG developers? Maybe someone
there can answer your question
http://groups.yahoo.com/group/svg-developers/
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.