Below I have two almost identical js loops.  The first works, and the second 
does too right up to the point of appending the child.  The first is embedded 
in my map, the second in the legend.  The second is used to append the map when 
the user clicks on a layer that has not yet been loaded.  My alerts indicate 
that myGeometryToAdd is properly retrieved via getElementById(theID+"1"), but 
when myGeometryToAdd.appendChild(child) is executed inside the Legend js, it 
throws the error "Wrong Document".  As a test I added a name variable to each 
myGeometryToAdd node, and I am able to correctly retrieve it in each case.  Am 
I not allowed to append one document from another?


---Map
while(child != null){
 // get sibling BEFORE parent changes
 childSibling = child.nextSibling;
 if(child.nodeType==1){
  theID = child.getAttributeNS(null,"id");
  myGeometryToAdd = document.getElementById(theID+"1");
  alert(window.printNode(myGeometryToAdd));
  alert(window.printNode(child));
  alert(myGeometryToAdd.getAttribute("name"));
  myGeometryToAdd.appendChild(child);
 }
 // continue processing with sibling
 child = childSibling;
}

---Legend
while(child != null){
 // get sibling BEFORE parent changes
 childSibling = child.nextSibling;
 if(child.nodeType==1){
  theID = child.getAttributeNS(null,"id");
  theMap=window.parent.document.getElementById("map")
  myGeometryToAdd = theMap.getElementById(theID+"1");
  alert(window.printNode(myGeometryToAdd));
  alert(window.printNode(child));
  alert(myGeometryToAdd.getAttribute("name"));
  myGeometryToAdd.appendChild(child);
 }
 // continue processing with sibling
 child = childSibling;
}



-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to