XML DOM localName 属性

定义和用法
localName 属性返回节点名称的本地部分。
语法
nodeObject.localName
实例
下面的代码片段使用 loadXMLDoc() 把 "books.xml" 载入 xmlDoc 中,并返回 <title> 元素的本地名称:
实例
xmlDoc=loadXMLDoc("books_ns.xml");
x=xmlDoc.getElementsByTagName('title');
for(i=0;i<x.length;i++)
{
document.write(x.item(i).localName);
document.write("
");
}
x=xmlDoc.getElementsByTagName('title');
for(i=0;i<x.length;i++)
{
document.write(x.item(i).localName);
document.write("
");
}
上面代码将输出:
title
title
title
尝试一下 »
