国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書(shū)等14項(xiàng)超值服

開(kāi)通VIP
XML DOM Clone Nodes

XML DOM Clone Nodes


Examples

In the examples below, we will use the XML file books.xml, and the JavaScript function loadXMLDoc().

Copy a node and add it to the node list
This example uses cloneNode() to copy a node and append it to a node list.


Copy a Node

The cloneNode() method creates a copy of a specified node.

The cloneNode() method has a parameter (true or false). This parameter indicates if the cloned node should include all attributes and child nodes of the original node.

The following code fragment copies the first <book> node and then adds the copy to the end of the node list:

xmlDoc=loadXMLDoc("books.xml");
var oldNode=xmlDoc.getElementsByTagName(‘book‘)[0];            var newNode=oldNode.cloneNode(true);            xmlDoc.documentElement.appendChild(newNode);            //Output all titles            var y=xmlDoc.getElementsByTagName("title");            for (i=0;i<y.length;i++)            {            document.write(y[i].childNodes[0].nodeValue);            document.write("<br />");            }

Output:

Everyday Italian            Harry Potter            XQuery Kick Start            Learning XML            Everyday Italian



本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶(hù)發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
XML DOM介紹
Javascript 操作XML
[轉(zhuǎn)載]JS創(chuàng)建XML
PHP 生成xml簡(jiǎn)單實(shí)例代碼
string 轉(zhuǎn)化xml xml轉(zhuǎn)化為string
使用javascript+dom+xml實(shí)現(xiàn)分頁(yè)
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服