Calculating table width using innerWidth gives inaccurate results
Posted on 2000-04-21
I have a table that I need to size exactly to the user's browser screen (i.e., no horizontal scrollbars). The reason for this is that I have multiple columns with multiple nested tables. Sometimes (in Netscape only), these tables will grow to 100% of the screen width regardless of the width of the containing table column. The only way Netscape properly displays those tables is if the outermost table has a pixel width (not a percentage width).
Anyway, I am using the window.innerWidth to calculate the number of pixels wide the user's browser window is. I then am setting dynamically the outermost table's WIDTH attribute. The problem is that innerWidth does not seem to be accurate. For instance, in my browser (Netscape 4.08), I get an innerWidth value of 1016. However, the correct width to display my table without scrollbars is actually 981 (35 pixels less). What's worse, if I drop to 800 x 600, the innerWidth is 892 but the correct width is 847 (45 pixels less). On another machine, the width at 800 x 600 is around 830 (62 pixels less).
Is there ANY way to control this or get the proper screen width so that consistently I draw a table without a horizontal scrollbar in its window?
BTW, I cannot use framesets to resolve this issue.
Thanks in advance!