I have 2 divs both hidden and absolute and sitting inside a relative div.

Both divs (the absolote ones) are hidden until a javscript event triggers them to be displayed and alters their content. The second absolute div I want to sit flush on the right side of the first absolute div with top borders lined up. However in javascript when I do:
document.getElementById("div_1").style.width or
document.getElementById("div_1").style.right - nothing is returned, so I can not position the second div.

I think this may be because the first div width is always different - depending on the contents it holds and doesn't have a defined style="width:###" attribute etc.

Can somebody help, I am fairly new to divs and CSS.