[WSG] Standards way of getting div background color?

2008-11-27 Thread Dennis Suitters

Dunno, if this has been asked before.

I've been looking wherever I can for a way to get a div's or any 
element's background color in a sementic friendly way (ie. works in IE 
and FF) using javascript.


so far i've tried the below:

document.getElementById('element').bgColor;



document.getElementById('element').style.backgroundColor;

TIA


***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***



Re: [WSG] Standards way of getting div background color?

2008-11-27 Thread Алексей Тен
Use window.getComputedStyle for standard-compliant browsers and
element.currentStyle for IE.

https://developer.mozilla.org/en/DOM/window.getComputedStyle
http://msdn.microsoft.com/en-us/library/ms535231(VS.85).aspx

On Thu, Nov 27, 2008 at 12:06, Dennis Suitters [EMAIL PROTECTED]wrote:

 Dunno, if this has been asked before.

 I've been looking wherever I can for a way to get a div's or any element's
 background color in a sementic friendly way (ie. works in IE and FF) using
 javascript.

 so far i've tried the below:

 document.getElementById('element').bgColor;

 

 document.getElementById('element').style.backgroundColor;

 TIA



-- 
Алексей

***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***