get style from element

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
srdva59
Forum Commoner
Posts: 77
Joined: Sun Feb 15, 2009 10:58 am

get style from element

Post 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
:)
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: get style from element

Post 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.
Post Reply