I know this sounds simple, but here's what i got that's not working.
<style type="text/css">#graphelement{width:800px;height:300px;}</style>
<div id="graphlabel2">Right Axis Label</div>
<div id="graphelement"></div>
<script type="text/javascript">
var graphwidth = document.getElementById('graphelement').style.width;
document.getElementById('graphlabel2').style.width = graphwidth;
</script>
My problem is that 'graphwidth' always comes up empty. If i just grab the element's width (element.width), i get 'undefined' in 'graphwidth. All code above is within the body tag, even the initial style tag.
This is part of a larger script, but i can figure the rest out if i can get a width from and element and set it to another. My overall goal: i have an element whose width is set in inline styles. If the page is viewed on a handheld (i.e., screen width is smaller than graphwidth), then i want to set the width of the element and associated elements to screen.width. I seem to be having trouble retrieving and setting element.style.width though.