XML DOM localNameプロパティ


Attr 对象参考手册Attr オブジェクト

定義と用法

localName プロパティは、属性名のローカル部分を返します。

構文

attrObject.localName


例

以下のコードスニペットはloadXMLDoc()「」を xmlDoc に読み込み、"lang" 属性のローカル名を返します:

例

xmlDoc=loadXMLDoc("books_ns.xml"); x=xmlDoc.getElementsByTagName('book'); ​ for(i=0;i<x.length;i++) { document.write("Prefix: " + x.item(i).attributes[0].prefix); document.write("<br>"); document.write("Local name: " + x.item(i).attributes[0].localName); document.write("<br>"); document.write("Namespace URI: " + x.item(i).attributes[0].namespaceURI); document.write("<br>"); document.write("Base URI: " + x.item(i).attributes[0].baseURI); document.write("<br>"); document.write("<br>"); }

試してみる »

Attr 对象参考手册Attr オブジェクト その他の拡張