aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Table width calculation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Table width calculation" Watch "Table width calculation" New topic
Author

Table width calculation

Anu Jv
Greenhorn

Joined: Apr 02, 2003
Posts: 14
Hi
I have a table with width set in percentage. Now I need to know the width of the table in pixels. Is this possible
<table width=100% border=0 id="MyTable">
<tr><td>Sample text</td></tr>
</table>
If I try "alert(document.getElementById("MyTable").width);" I get 100% but I need the width in pixels as the pixels occupied by the table will differ when the window is resized
Thx
Anu
Susilo Saja
Ranch Hand

Joined: May 27, 2003
Posts: 91
You can use the "offsetWidth" property
Susilo
Anu Jv
Greenhorn

Joined: Apr 02, 2003
Posts: 14
Thanks. It works fine
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Table width calculation
 
Similar Threads
equivalent of frames in struts
EJB Table, please correct me and contribute
Dynamic table generation in jsp
width of HTML table cell
table cells not aligning