...

View Full Version : Retrieve all styles from element



Jerome
04-10-2003, 10:14 AM
Hi,

When I have a div like:

<div id="mydiv">Hello world</div>

With (in a separate css-file) styles like:

#mydiv
{
width:100px;
border:1px solid red;
}

I like to have an alert showing all styles of this div.

And when it's possible also styles I did not mentioned in mydiv, like height etc, the basic settings

Tried something like:

function f1(){
alert(document.getElementById('mydiv').style.border-color);
}

Any idea? thanks,
Jerome

beetle
04-10-2003, 03:32 PM
You need to read from the currentStyle object in IE

See this page (http://www.peterbailey.net/dhtml/styles.htm) for more info

Jerome
04-10-2003, 09:48 PM
Good explenation!

Thanks Beetle,
Jerome



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum