中文字幕一区二区人妻电影,亚洲av无码一区二区乱子伦as ,亚洲精品无码永久在线观看,亚洲成aⅴ人片久青草影院按摩,亚洲黑人巨大videos

XML DOM getElementsByTagNameNS() 方法


Document 對(duì)象參考手冊(cè) Document 對(duì)象

定義和用法

getElementsByTagNameNS() 方法返回帶有指定名稱和命名空間的所有元素的 NodeList。

語(yǔ)法

getElementsByTagNameNS(ns,name)
參數(shù) 描述
ns 字符串,規(guī)定要搜索的命名空間名稱。值 "*" 匹配所有的標(biāo)簽。
name 字符串,規(guī)定要搜索的標(biāo)簽名。值 "*" 匹配所有的標(biāo)簽。

實(shí)例

實(shí)例

xmlDoc=loadXMLDoc("books.xml"); x=xmlDoc.getElementsByTagName('book'); var newel,newtext; for (i=0;i<x.length;i++) { newel=xmlDoc.createElementNS("p","edition"); newtext=xmlDoc.createTextNode("First"); newel.appendChild(newtext); x[i].appendChild(newel); } // 輸出所有 title 和 edition y=xmlDoc.getElementsByTagName("title"); z=xmlDoc.getElementsByTagNameNS("p","edition"); for (i=0;i<y.length;i++) { document.write(y[i].childNodes[0].nodeValue); document.write(" - "); document.write(z[i].childNodes[0].nodeValue); document.write(" edition."); document.write(" Namespace: "); document.write(z[i].namespaceURI); document.write("<br>"); }

運(yùn)行代碼 ?

Document 對(duì)象參考手冊(cè) Document 對(duì)象其他擴(kuò)展