Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » JavaScript

Final width of a table?

 
Jump to:  
 
CKKwan
PostPosted: 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
PostPosted: 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
PostPosted: 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
PostPosted: 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
PostPosted: 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
PostPosted: 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()">
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

przeprowadzki międzynarodowe Allegro Translate zakłady bukmacherskie Wózki widłowe