javascript当中replaceChild的用法

例 1.6(replaceChildIEFF.html)
马克- to-win:马克 java社区:防盗版实名手机尾号: 73203。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
</HEAD>
<BODY>
<div id="contain">
    <div id="a">a </div>
    <div id="b">b </div>
    <div id="c">c </div>
</div>

<script>
var contain = document.getElementById("contain");
var b =  document.getElementById("b");
var p =  document.createElement("p");/*这句话后创建了一个<p>*/
p.innerHTML="pText";
/*
Node.replaceChild() (Method)
A means of replacing child objects with new nodes and discarding the old ones.
The new node must be created using the createElement method.




Property/method value type: Node object
JavaScript syntax: - myNode.replaceChild(newNode, oldNode)
Argument list: newNode The node to be placed into the hierarchy
oldNode The node to be replaced
*/

contain.replaceChild( p , b  );
</script>
</BODY>
</HTML>