Nov 21

IE: removeNode(false)

which does not work for FireFox. I search around the Net but I could not get any valuable source from which I could get help. However, I tried it in the following way and it works for me.

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Equivalent of removeNode(false)</title>
</head>
<body>
    <div>
        <p>
            Hello, I am from CodersBlog.<span>During my childhood<font color="green">I missed so many things</font> that I can not cover
                in <b>the rest of my life</b></span>
        </p>
    </div>

    <script type="text/javascript">
    var tgt=document.getElementsByTagName("font");
    for (i=0; i<tgt.length;i++){
        if (tgt[i].removeNode)
            tgt[i].removeNode(false);
        else{
            var child=tgt[i].childNodes;
//            var childIns=tgt[i].parentNode.insertBefore(child[0], child[0].previousSibling);
//            while(child[0]){
//            childIns=tgt[i].parentNode.insertBefore(child[0],childIns);
//            }
       
            tgt[i].parentNode.replaceChild(child[0],tgt[i]);
        }
    }
    </script>

</body>
</html>

See the live demonstration here,

 

Hello, I am from CodersBlog.During my childhoodI missed so many things that I can not cover in the rest of my life

Comments

Add comment


 

  Country flag

biuquote
  • Comment
  • Preview
Loading