Applies a string of styles to an object.
obj
str
so_applyStyleString(document.getElementById("mainContainer"),"border:1px solid #000;background-color:#FF0;");
No specific examples as this is rather straight forward. Instead of obj.style.background=...
and obj.style.border=...
you can take care of it all at once.
function so_applyStyleString(obj,str) {
if(document.all && !window.opera) {
obj.style.setAttribute("cssText",str);
} else {
obj.setAttribute("style",str);
}
}
This code is issued under a Creative Commons license. You do not need my permission to use it, though I'm always interested in seeing where my code has ended up if you want to drop me a line.
slayeroffice main