Accessing DOM elements in an embedded doc

Discussion in 'XML' started by Julius Mong, Apr 5, 2004.

  1. Julius Mong

    Julius Mong Guest

    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
     
    Julius Mong, Apr 5, 2004
    #1
    1. Advertising

  2. 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-HTML/html.html#ID-67133006
    http://www.w3.org/TR/DOM-Level-2-HTML/html.html#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/
     
    Martin Honnen, Apr 5, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Wallace
    Replies:
    0
    Views:
    479
    John Wallace
    Jul 22, 2003
  2. Matt
    Replies:
    3
    Views:
    522
    Tor Iver Wilhelmsen
    Sep 17, 2004
  3. Gerald Aichholzer
    Replies:
    2
    Views:
    2,522
    Gerald Aichholzer
    Jun 27, 2006
  4. Chris Seberino
    Replies:
    3
    Views:
    751
    Stefan Behnel
    Jun 12, 2009
  5. Julius Mong

    Accessing DOM elements in an embedded doc

    Julius Mong, Apr 5, 2004, in forum: Javascript
    Replies:
    4
    Views:
    103
Loading...

Share This Page