I think you could use the (IE only) property clientWidth.
The following example will show a message box saying that the width of the textbox is 196 pixels (because margin and border are not included in the clientWidth). Save to an HTML page, run it and click the button:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script type="text/javascript">
function SayWidth()
{
alert('Width is ' + document.getElementById('MyTableCell').clientWidth);
}
</script>
</head>
<body>
<form id="frmTest">
<table width="200px" border="1" id="MyTable" cellpadding="0" cellspacing="0">
<tr>
<td id="MyTableCell"> </td>
</tr>
</table>
<input type="button" value="Say Width" onClick="SayWidth();" />
</form>
</body>
</html>
The clientWidth will return the real width. So, if you put a large image inside the table cell, or unwrappable text, the table cell will grow and the clientWidth will report a wider table cell.
Look here for more information:
http://msdn.microsoft.com/library/de...asp?frame=true
Does this help?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to:
Jam For the Ladies by
Moby (Track 10 from the album:
18)
What's This?