TOC PREV NEXT INDEX

domref



getAttributeNS


getAttributeNS returns the value of the attribute with the given name and namespace.

Syntax

attribute = element.getAttributeNS(namespace, name)
 

Parameters

attribute is an attribute node

namespace is the namespace of the requested attribute.

name is the name of the attribute whose value you want to get.

Example

div1 = document.getElementById("div1");
 
a = divvy.getAttributeNS(
 
  "www.mozilla.org/ns/specialspace/",
 
  "special-align");
 
alert(a); // shows the value of align for that DIV
 

Notes

getAttributeNS is another very common and useful method for web developers. It differs from getAttribute in that it allows you to further specify the requested attribute as being part of a particular namespace, as in the example above, where the attribute is part of the fictional "specialspace" namespace on mozilla.

The corollary to this method is setAttributeNS, which allows you to change the value of a named attribute.

Specification

getAttributeNS
 


Netscape Communications
http://developer.netscape.com
TOC PREV NEXT INDEX