Добавить
Уведомления

JavaScript Tutorial - getAttribute setAttribute & hasAttribute

These methods are defined on the Element interface. DOMString? getAttribute(DOMString name); void setAttribute(DOMString name, DOMString value); void removeAttribute(DOMString name); boolean hasAttribute(DOMString name); The getAttribute(name) method must run these steps: If the context object is in the HTML namespace and its node document is an HTML document, let name be converted to ASCII lowercase. Return the value of the first attribute in the context object's attribute list whose name is name, and null otherwise. The setAttribute(name, value) method must run these steps: If name does not match the Name production in XML, throw an "InvalidCharacterError" exception. If the context object is in the HTML namespace and its node document is an HTML document, let name be converted to ASCII lowercase. Let attribute be the first attribute in the context object's attribute list whose name is name, or null if there is no such attribute. If attribute is null, create an attribute whose local name is name and value is value, and then append this attribute to the context object and terminate these steps. Change attribute from context object to value. The removeAttribute(name) method must run these steps: If the context object is in the HTML namespace and its node document is an HTML document, let name be converted to ASCII lowercase. Remove the first attribute from the context object whose name is name,if any. The hasAttribute(name) method must run these steps: If the context object is in the HTML namespace and its node document is an HTML document, let name be converted to ASCII lowercase. Return true if the context object has an attribute whose name is name, and false otherwise. https://github.com/webtunings https://www.facebook.com/pages/WebTunings/339234242822202 I highly recommend this book for beginners as well as advanced programmers: http://www.amazon.com/gp/product/0596805527/ref=as_li_qf_sp_asin_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0596805527&linkCode=as2&tag=webtuningscom-20

Иконка канала JS Веб-гуру
73 подписчика
12+
17 просмотров
2 года назад
12+
17 просмотров
2 года назад

These methods are defined on the Element interface. DOMString? getAttribute(DOMString name); void setAttribute(DOMString name, DOMString value); void removeAttribute(DOMString name); boolean hasAttribute(DOMString name); The getAttribute(name) method must run these steps: If the context object is in the HTML namespace and its node document is an HTML document, let name be converted to ASCII lowercase. Return the value of the first attribute in the context object's attribute list whose name is name, and null otherwise. The setAttribute(name, value) method must run these steps: If name does not match the Name production in XML, throw an "InvalidCharacterError" exception. If the context object is in the HTML namespace and its node document is an HTML document, let name be converted to ASCII lowercase. Let attribute be the first attribute in the context object's attribute list whose name is name, or null if there is no such attribute. If attribute is null, create an attribute whose local name is name and value is value, and then append this attribute to the context object and terminate these steps. Change attribute from context object to value. The removeAttribute(name) method must run these steps: If the context object is in the HTML namespace and its node document is an HTML document, let name be converted to ASCII lowercase. Remove the first attribute from the context object whose name is name,if any. The hasAttribute(name) method must run these steps: If the context object is in the HTML namespace and its node document is an HTML document, let name be converted to ASCII lowercase. Return true if the context object has an attribute whose name is name, and false otherwise. https://github.com/webtunings https://www.facebook.com/pages/WebTunings/339234242822202 I highly recommend this book for beginners as well as advanced programmers: http://www.amazon.com/gp/product/0596805527/ref=as_li_qf_sp_asin_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0596805527&linkCode=as2&tag=webtuningscom-20

, чтобы оставлять комментарии