开发者

parenNode.replaceChild not working in IE6

开发者 https://www.devze.com 2023-03-24 11:30 出处:网络
I had a table element in my Html file of FCK editor which i tried to replace with new table element using parentNode.replaceChild method.Though it works fine in Internet Explore 8 but gives me error i

I had a table element in my Html file of FCK editor which i tried to replace with new table element using parentNode.replaceChild method.Though it works fine in Internet Explore 8 but gives me error in IE 6 as well as IE 7.The error i get is "proper开发者_Go百科ty does not support this object or method".Here is my snippet of code:

var eSelected = FCK.Selection.MoveToAncestorNode( 'TABLE' ); 

var myTable = document.createElement('TABLE');

var temp1= '<span><strong>' + Title.value + '</strong></span>'; //title.value is value retrieved from a text box

var temp2= '<a onBlur="window.status=' + ';return true"                         

onMouseOver="window.status=' + ';return true" ' +   'onFocus="window.status=' + ';return true" onMouseOut="window.status=' + ';return true" ' +'href="javascript:pdfPopup('+'\'' + Name.value + '\''+');">'+Name.value+'</a><span>[' + Size.value + ']</span>'; //name.value is also retrieved from a text box

            var row1 = myTable.insertRow(0); //create new rows in the table 
    var cell1= row1.insertCell(0);
        cell1.innerHTML=temp1;

    var row2 = myTable.insertRow(1);
    var cell2= row2.insertCell(0);
        cell2.innerHTML=temp2;

    var row3 = myTable.insertRow(2);
    var cell3= row3.insertCell(0);
        cell3.innerHTML='&nbsp;';

    eSelected.parentNode.replaceChild(myTable,eSelected); // I m getting error at this line`


Do you have a <tbody> tag enclosing the rows?

<table><tbody><tr></tr><tr></tr></tbody></table>

(Sorry, that I can't write this as a comment. I don't have the privileges to do so…)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号