Hi Jeri,
I am not 100% sure, but I don't think you can do that. Consider the following example:
Code:
<html>
<head>
<title>Test Width</title>
<script language="JavaScript" type="text/javascript">
function TestMe()
{
alert(document.getElementById('spTest').style.width);
}
</script>
</head>
<body>
<span id="spTest">This is a test</span>
<input type="button" value="Click" onclick="TestMe();">
</body>
</html>
If you run this, and click the button, you'll get an empty dialog box, indicating that the width is empty / null / undetermined.
If you change the span tag to this:
Code:
<span id="spTest" style="width: 100px">
the dialog box will now show "100px". So I am afraid that it looks like the browser won't tell you how wide an element is if you haven't explicitly stated it first.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.