XML DOM localName 属性

返回上一级

XML DOM Attr 对象的 localName 属性返回属性名称的本地部分

语法

attrObject.localName

范例

下面的范例返回 "lang" 属性的本地名称

xmlDoc=loadXMLDoc("/static/media/dom/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>");
}

运行范例 »

返回上一级

XML DOM 基础教程

关于   |   FAQ   |   我们的愿景   |   广告投放   |  博客

  简单教程,简单编程 - IT 入门首选站

Copyright © 2013-2022 简单教程 twle.cn All Rights Reserved.