This could be useful to have a fast way of changing many elements that
have a common CSS class.
it has been tested on IE/Firefox, not safari.
it should work well on differents browsers, provided you use basic CSS
selectors, like
".myclass" or "div.myclass"
{{{
function changeCSSProperty(pSelector, pProperty, pValue) {
for (var i=0; i < document.styleSheets.length; i++) {
var lSs = document.styleSheets[i];
var lRules = (lSs.cssRules != null) ? lSs.cssRules : lSs.rules;
if (lRules == null) continue;
var fRulenum = -1;
for (var j=0; j<lRules.length; j++) {
if (lRules[j] != null &&
lRules[j].selectorText.toLowerCase() ==
pSelector) {
fRulenum = j;
break;
}
}
if (fRulenum < 0) continue;
lRules[fRulenum].style[MochiKit.Base.camelize(pProperty)] =
pValue;
}
}
}}}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---