javascript当中insertBefore的用法

例 1.3(insertBeforeIEFF.html)
<!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
 

更多内容请见原文,文章转载自:https://blog.csdn.net/qq_44594371/article/details/103063631

posted @ 2021-12-11 17:02  malala  阅读(321)  评论(0编辑  收藏  举报