Functia "seteaza" un atribut pentru un obiect .
function SetAttribute(object, attrName, attrValue) { if (document.getElementById) { if (object.hasAttribute) { if (object.hasAttribute(attrName)) { if (object.getAttribute) { if (object.getAttribute(attrName) == attrValue) { return true; } } if (object.removeAttribute) { object.removeAttribute(attrName); } } } if (object.setAttribute) { object.setAttribute(attrName, attrValue); return true; } var attr = document.createAttribute(attrName); if (attr) { attr.nodeValue = attrValue; if (object.setAttributeNode) { object.setAttributeNode(attr); return true; } } } return false;}function SetAttributeByID(objectID, attrName, attrValue) { if (document.getElementById) { var object = document.getElementById(objectID); if (object) { return SetAttribute(object, attrName, attrValue); } } return false;}