How to append a Node created in another document ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mentor
    New Member
    • Mar 2007
    • 24

    How to append a Node created in another document ?

    I tried this way, but don't work.
    in current document, first get the node

    Code:
    var aNode = document.getElementById("anode");
    then, import the node to the other target document, and append it,

    Code:
      newNode = targetdocument.importNode(aNode);
      targetdocument.body.appendChild(newNode);
    IE6 reports the method importNode() not supported. Is there any other way? thanks
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Try cloneNode instead.

    Comment

    Working...