XML DOM removeAttributeNS() ����
�������÷�
removeAttributeNS() ����ɾ���������ռ�������ָ�������ԡ�
���
elementNode.removeAttributeNS(ns,name)
���� | ���� |
---|---|
ns | ���衣�涨Ҫɾ�������Ե����ֿռ䡣 |
name | ���衣�涨Ҫɾ�������Ե����ơ� |
ʵ��
�����е������У����ǽ�ʹ�� XML �ļ� books_ns.xml���Լ� JavaScript ���� loadXMLDoc()��
�����Ĵ���Ƭ�δ� "books_ns.xml" �еĵ�һ�� <title> Ԫ��ɾ�� "lang" ���ԣ�
xmlDoc=loadXMLDoc("books_ns.xml"); x=xmlDoc.getElementsByTagName("title")[0]; ns="http://www.w3school.com.cn/children/"; document.write("Attribute Found: "); document.write(x.hasAttributeNS(ns,"lang")
); x.removeAttributeNS(ns,"lang"); document.write("<br />Attribute Found: "); document.write(x.hasAttributeNS(ns,"lang")
);
������
Attribute Found: true Attribute Found: false