XML DOM specified 屬性
Attr 對(duì)象
定義和用法
如果在文檔中設(shè)置了屬性值,則 specified 屬性返回 true,如果是 DTD/Schema 中的默認(rèn)值,則返回 false。
語(yǔ)法
實(shí)例
下面的代碼片段使用 loadXMLDoc() 把 "books.xml" 載入 xmlDoc 中,并顯示 category 屬性的名稱和值:
實(shí)例
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName('book');
for(i=0;i<x.length;i++)
{
document.write(x.item(i).attributes[0].specified);
document.write("
");
}
輸出:
true
true
true
true
嘗試一下 ?
Attr 對(duì)象
更多建議: