XML DOM baseURI 属性——Attr 对象
2018-08-05 16:26 更新
XML DOM baseURI 属性
![Attr 对象参考手册](https://7n.w3cschool.cn/statics/images/course/up.gif)
定义和用法
baseURI 属性返回属性的绝对基准 URI。
语法
attrObject.baseURI
实例
下面的代码片段使用 loadXMLDoc() 把 "books_ns.xml" 载入 xmlDoc 中,并返回 "lang" 属性的基准 URI:
实例
xmlDoc=loadXMLDoc("books_ns.xml");
x=xmlDoc.getElementsByTagName('title');
for(i=0;i<x.length;i++)
{
document.write(x.item(i).attributes[0].baseURI);
document.write("
");
}
x=xmlDoc.getElementsByTagName('title');
for(i=0;i<x.length;i++)
{
document.write(x.item(i).attributes[0].baseURI);
document.write("
");
}
上面的代码将输出:
//www.w3cschool.cn/dom/books_ns.xml
//www.w3cschool.cn/dom/books_ns.xml
//www.w3cschool.cn/dom/books_ns.xml
尝试一下 »
![Attr 对象参考手册](https://7n.w3cschool.cn/statics/images/course/up.gif)
以上内容是否对您有帮助:
更多建议: