XML DOM isId 屬性
Attr 對(duì)象
定義和用法
isId 屬性在屬性是 ID 類(lèi)型時(shí)返回 true(例如,包含了其所屬的元素的標(biāo)識(shí)符),否則返回 false。
語(yǔ)法
實(shí)例
下面的代碼片段使用 loadXMLDoc() 把 "books.xml" 載入 xmlDoc 中,并返回 category 屬性是否是 <book> 元素的 ID 屬性:
實(shí)例
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName('book');
for(i=0;i<x.length;i++)
{
document.write(x.item(i).attributes[0].isId);
document.write("
");
}
上面的代碼將輸出:
false
嘗試一下 ?
Attr 對(duì)象
更多建議: