I have some function like below, that sets inline css attribute to the elements. It's kinda very simplified JQuery's .css() method:
function cssSetAttr(styleName, value) {
for (var i = 0, n = someObject.length; i < n; i++) {
someObject[i].setAttribute('style', [styleName][value]);
}
someObject.cssSetAttr('color', 'red');
Problem is how to put arguments into setAttribute like this:
setAttribute('style', 'styleName: value')
setCSS('propertyName', 'value')and use this internally within the function:element.style[propertyName]. This has the benefit that you can call it multiple times on the same element without overwriting any previous values.