Javascript appenChild() method is not working in IE

  •  10-23-2008, 4:43 PM

    Javascript appenChild() method is not working in IE


     Hi guys,
     
    I want to insert a new div element into the editor document using the appendChild() method.
     
    Javascript Code:-
    /////////////////////////////////////////////////////////////////////////////////
    var e1 = document.getElementById('<%=Editor1.ClientID%>');
    var getDoc = e1.GetDocument();
    var imgElement = document.createElement("img");
    imgElement.setAttribute("src", "logo.jpeg");
    getDoc.getElementById('ParentDIV').appendChild(imgElement);   //Line giving the error in IE
    /////////////////////////////////////////////////////////////////////////////////
     
    The above code is working fine in the Firefox, but it is throwing the javascript error in IE. The error message says "invalid argument". Please let me know where am i making the mistake?
     
    Thanks

    Karan Singh
    (Web Developer)
View Complete Thread