if I have a layer say
<style>
#lay1 { position:absolute; width:200px; etc...}
</style>

and then I want to perform an action based on the values of width of lay1

i thought you can just pass the value to a simple data type
like this

var widthOflayer;

widthOflayer = document.GetElementById("lay1").style.width;
alert("Value is " + widthOfLayer);


I was told that this does not work because that property is not
initialized;

I was hoping that it would be able to see that I did initialize it by specifying the width to be 200px (in the <style> tags)

in other words I need to do this


document.GetElementById("lay1").style.width = 200
var widthOflayer;
widthOflayer = document.GetElementById("lay1").style.width;
alert("Value is " + widthOfLayer);


which to be makes no sense..

is there a way around this?

i get the same result with string values such style.backgroundColor for ex.


bsw2112