www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] help:replaceChild invalid argument

  1. #1
    Join Date
    Mar 2009
    Posts
    22

    resolved [RESOLVED] help:replaceChild invalid argument

    I have implemented a feature for dojo rich text.I got to an issue that causing the invaild argument error in IE7.However,it can work well in firefox.Could anyone please see why causing this issue?Maybe the textNode object bring this issue or because of the dojo rich text is an frame?

    The scripts as bellows:
    function findAndReplaceWord(word){
    var currentNode = hiliteWords[currentNodeIndex];
    var textNode = dojo.doc.createTextNode(word);
    currentNode.parentNode.replaceChild(textNode,currentNode);//causing the error line
    textNode = null;
    }

    Thank you very much!

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    It is hard to say, as we don't know what currentNode and dojo.doc are. But I put a dime on a bet. I guess you try to create/remove/replace an element from another document (an iframe, a pop-up, an opener or a parent). Make sure you use the correct and full reference of the document you are working with.

    For instance, if your code is written in an iframe, but you need to do something in the DOM of its parent, make sure you work in the correct document, that means the parent:
    Code:
    var doc=parent.document;
    var element=doc.getElementById('myelement');
    element.parentNode.removeChild(element);

  3. #3
    Join Date
    Mar 2009
    Posts
    22

    Thumbs up Thanks

    Thanks for your help!
    I have solved this problem.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles