Returns a boolean indicating whether the current element has the specified attribute.
Usage
boolVal = element.hasAttribute(attrName)
attrName is a string representing the name of the attribute
Example
// check that the attirbute exists
// before you set a value
div = document.getElementById("div1");
if (d.hasAttribute("align")) {
d.setAttribute("align", "center");
}