javascript当中insertBefore的用法

javascript当中insertBefore的用法例1.3(insertBeforeIEFF.html)<!DOCTYPEHTMLPUBLIC”-//W3C//DTDHTML4.0Transitional//EN”><HTML><head><metahttp-equiv=”content-type”content=”text/html;charset=utf-8″/&g…

例 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”);
/*
 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

更多请见:http://www.mark-to-win.com/tutorial/js_7_NodeinsertBefore.html

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/38849.html

(0)
编程小号编程小号

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注