Final width of a table?

C

CKKwan

Dear All,

I specified the table width to be 50% (regardless of whether I specify
or not), but the final width of the table will be different because of
its content.

Quesion now is how can I find out the final width?

table.width or table.style.width only returns the value that I have
specify (or null if I do not specify).

Thankd in advace!
 
G

GArlington

Dear All,

I specified the table width to be 50% (regardless of whether I specify
or not), but the final width of the table will be different because of
its content.

Quesion now is how can I find out the final width?

table.width or table.style.width only returns the value that I have
specify (or null if I do not specify).

Thankd in advace!

See DOM, Firebug in FF is your best friend for this purpose...
 
S

sturyuu5eye

alert(document.getElementById("yourTable").offsetWidth);- Hide quoted text -

- Show quoted text -

Thanks for the answer. There is two issues.

1. I am using IIS with ASPNET, I can get the width in scrollWidth, and
clientWidth, but not offsetWidth. May I know what are the different
between these 3 values?

2. The width are not updated until it is completely render. Means if I
put a java script at the bottom of the page and try to read this
value, it will return 0. I can only read these value later (trigger by
an event, example timer / user click). Is there a better way to get
these value?
 
G

Guest

2. The width are not updated until it is completely render. Means if I
put a java script at the bottom of the page and try to read this
value, it will return 0. I can only read these value later (trigger by
an event, example timer / user click). Is there a better way to get
these value?

Perhaps <body onload="function-to-check-value()">
 

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

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,525
Members
44,997
Latest member
mileyka

Latest Threads

Top