XML DOM removeAttributeNS() 方法

التعريف والاستخدام

removeAttributeNS() ي�除属性由命名空间和名称指定的方法。

الجملة

elementNode.removeAttributeNS(ns,name)
المتغيرات الوصف
ns مطلوب. يحدد مسمى النطاق الذي يتم إزالة الخاصية منه.
name مطلوب. يحدد اسم الخاصية التي يتم إزالتها.

مثال

السطر التالي سيدخل "books_ns.xml" إلى xmlDoc ويزيل الخاصية "lang" من العنصر الـ <title> الأول:

var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
   if (this.readyState == 4 && this.status == 200) {
       myFunction(this);
   "<br>تم العثور على الخاصية: " + x.hasAttributeNS(ns, "lang");
};
xhttp.open("GET", "books_ns.xml", true);
xhttp.send();
function myFunction(xml) {
    var xmlDoc = xml.responseXML;
    var x = xmlDoc.getElementsByTagName("title")[0];
    var ns = "https://www.codew3c.com/meishi/";
    document.getElementById("demo").innerHTML =
    "عثور على الخاصية: " + x.hasAttributeNS(ns, "lang");
    x.removeAttributeNS(ns, "lang");
    x.removeAttributeNS(ns, "lang");
    document.getElementById("demo").innerHTML +=
"<br>تم العثور على الخاصية: " + x.hasAttributeNS(ns, "lang");

}