TOC PREV NEXT INDEX

domref



hasAttributeNS


hasAttribute is a boolean value indicating whether the current element has an attribute with the specified name and namespace.

Syntax

[ true | false ] = element.hasAttribute(namespace, localName)
 

Parameters

boolean true | false

namespace is a string representing the namespace you are looking for

localName is a string representing the name of the attribute

Example

// check that the attirbute exists
 
// before you set a value
 
d = document.getElementById("div1");
 
if d.hasAttributeNS(
 
  "http://www.mozilla.org/ns/specialspace/", 
 
  "special-align") { d.setAttribute("align", "center"); }
 

Notes

None.

Specification

hasAttributeNS
 


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