donelson
05-05-2008, 11:08 PM
I have a table in a div, and I want to get its current width depending on what text is in it:
var toolTip_field = document.getElementById("toolTip_field");
// This displays the correct text string on screen
toolTip_field.innerHTML = "This is a string";
alert(toolTip_field.width) --> blank alert box
My toolTip field is defined as:
<!-- Tool Tip code -->
<div id="toolTip_obj" style="position: absolute; left: 600px; top: 300px; z-index:4;">
<font size="1" face="Arial, Helvetica, sans-serif">
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td id="toolTip_field" valign="top" align="center" bgcolor="#FFFFcc">
tool tip
</td>
</tr>
</table></font>
</div>
Is it possible to get the field's width?
Thanks!
var toolTip_field = document.getElementById("toolTip_field");
// This displays the correct text string on screen
toolTip_field.innerHTML = "This is a string";
alert(toolTip_field.width) --> blank alert box
My toolTip field is defined as:
<!-- Tool Tip code -->
<div id="toolTip_obj" style="position: absolute; left: 600px; top: 300px; z-index:4;">
<font size="1" face="Arial, Helvetica, sans-serif">
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td id="toolTip_field" valign="top" align="center" bgcolor="#FFFFcc">
tool tip
</td>
</tr>
</table></font>
</div>
Is it possible to get the field's width?
Thanks!