javascript当中insertBefore的用法

例 1.3(insertBeforeIEFF.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">
    <p id="content">1111</p>
    <div id="msg">
        msg
        <div>test</div>
    </div>
    <p id="content1">222</p>
    <p id="aaa">aaaaaaaa</p>
</div>
end
<div id="insertedNode">insertedNode</div>
<script>
var insertedNode = document.getElementById("insertedNode");
var aaa = document.getElementById("aaa");
var test = document.getElementById("contain");
/*
马克-to-win: first comment out the following statement, see the effect, then uncomment out the following statement, see the effect again.




Node.insertBefore() (Method)
This method inserts a child element into the collection at the indicated position.(qixy: here
"contain" is a collecton.)

返回值:Property/method value type: Node object
JavaScript syntax: - myNode.insertBefore(aNode1, aNode2)
Argument list: aNode1 The node to be inserted
aNode2 The node indicating the insertion point

马克-to-win: insertedNode is no more displayed in the originla position after insertion.
it looks like that insertedNode is deleted already.
understandably,test should include aaa, because test should be a collection, which include aaa..
*/
test.insertBefore( insertedNode , aaa );
</script>
</BODY>
</HTML>