On Jan 8, 2006, at 9:44 PM, DrSlump wrote:


Worik wrote:
Friends

I have a submit button that I wish to change it's colour.

I have tried:
updateNodeAttributes('idOfButton', {'style': {'background-color':
'#ff0000'}});
                        
And this does nothing.

What am I doing wrong?


I'm new to mochikit so maybe I'm in the wrong path, but I guess that you need to pass as argument the computed style property name and not the css declaration one. So change 'background-color' with 'backgroundColor' and see what happens. In general when referring to property names which have a hyphen in them you just need to remove the hyphen and put in uppercase the first letter of the second word. For example: font-weight = fontWeight, border-color = borderColor ... All this is because in Javascript (as in most programming languages) a name can't have a hyphen in it since it's used as the arithmetic subtract operation.

That is correct. If you want to set the style in pure CSS then you must set it as a string... but that will change all of the style, where the property version will just update those components.

In other words, this should work:
{"style": "background-color: #ff0000"}

and so should this:
{"style": {"backgroundColor": "#ff0000"}}

-bob

Reply via email to