Page 1 of 1

get style from element

Posted: Tue Jan 08, 2013 6:51 pm
by srdva59
hi,
i have some style property in a array for example

color[1] = "color";
color[2] = "background";

now i want ger the style property of a object but i don“t know
how call.

for example: obj.style + color[1] but this only return:

[object CSSStyleDeclaration], how can i see the value that is set?
thanks for your help
:)

Re: get style from element

Posted: Tue Jan 08, 2013 7:15 pm
by requinix

Code: Select all

obj.style.color
If you have just "color" as a string then

Code: Select all

obj.style["color"]
works too.