|  | Final width of a table? |  | |
| | | CKKwan |  |
| Posted: Wed Sep 03, 2008 7:07 am Post subject: Final width of a table? |  |
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! |
| |
| | | GArlington |  |
| Posted: Wed Sep 03, 2008 12:44 pm Post subject: Re: Final width of a table? |  |
On Sep 3, 8:07 am, CKKwan <ckk...@my-deja.com> wrote:
| Quote: | 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... |
| |
| | | Laser Lips |  |
| Posted: Wed Sep 03, 2008 12:57 pm Post subject: Re: Final width of a table? |  |
On Sep 3, 1:44 pm, GArlington <garling...@tiscali.co.uk> wrote:
| Quote: | On Sep 3, 8:07 am, CKKwan <ckk...@my-deja.com> wrote:
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...
|
alert(document.getElementById("yourTable").offsetWidth); |
| |
| | | Martin Honnen |  |
| Posted: Wed Sep 03, 2008 1:57 pm Post subject: Re: Final width of a table? |  |
CKKwan wrote:
| Quote: | Quesion now is how can I find out the final width?
|
tableElement.offsetWidth
--
Martin Honnen http://JavaScript.FAQTs.com/ |
| |
| | | Guest |  |
| Posted: Fri Sep 05, 2008 1:53 pm Post subject: Re: Final width of a table? |  |
| Quote: | 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? |
| |
| | | Guest |  |
| Posted: Fri Sep 05, 2008 3:26 pm Post subject: Re: Final width of a table? |  |
On Fri, 5 Sep 2008 06:53:30 -0700 (PDT), sturyuu5eye@gmail.com wrote in <6b6d2669-ee5f-44ca-b767-4ca72f56968c@q26g2000prq.googlegroups.com>:
| Quote: | 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()"> |
| |
|
|