get containing table width

M

Marc Lambrichs

I want to dynamically (cross-browser) read the width of the table a td
element belongs to. Any ideas?

Cheers,
 
D

DU

Marc said:
I want to dynamically (cross-browser) read the width of the table a td
element belongs to. Any ideas?

Cheers,


Assuming
<td id="idTableCell" ...>
then

var WidthOfTable =
document.getElementById("idTableCell").offsetParent.offsetWidth;

should work in MSIE 6 for Windows in standards compliant rendering mode,
Mozilla-based browsers (17 browsers) and Opera 7.x

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunclear/Netscape7/Netscape7Section.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,573
Members
47,205
Latest member
ElwoodDurh

Latest Threads

Top