LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-19-2003, 02:26 PM   #1
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
html page layouts with a table


howdy howdy howdy, i'm asking a question!

Is there anyway to let html code, e.g. a table, draw itself out without paying any attention to the size of the page? I have a situation where i am drawing a table which needs to fit precisely inside a window, but I want the content to define the size of the window. Sadly i'm coding an intranet that only uses IE, and can't find any other way to accomplish this as ie values such as document.body.scrollwidth just increase to the entire width of the page, so to get a suitable value I am resizing the window to (100,100) and then getting the scroll value. but of course resizing it makes the table details wrap. I've combatted this for now with some <nobr>'s and other padding but this sucks. any way to stop this happening? in a div or something?

Or alternatively will a div potentially be able to shrink to fit a table when the entire page won't? I fundamentally want to get the size of an unadultered, unrestrained, unwrapped table. possible?

Any other way I'm too dumb to think of?

[for drew] mock version of the page: http://thirtythreeandathird.net/blahblah.html
as you can guess if you make the page smaller than the table it wraps. if you make the page larger, there's no way to find the width of the table.

Last edited by acid_kewpie; 06-19-2003 at 02:47 PM.
 
Old 06-19-2003, 02:49 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
If I understand you correctly:
How about drawing the table, finding it's width then resizing the window to that width.
 
Old 06-19-2003, 02:55 PM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Original Poster
Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Quote:
finding it's width
but how? only way i've found is to make the page smaller than the table and reference scrollwidth for IE, which causes the table to distort. I've found plenty of great ways to resize a popup to fit an image, but an image won't resize itself if in a confinded space, text, and therefore a table, will.
 
Old 06-19-2003, 03:16 PM   #4
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
You want the table to fit the windows? width="100%" ?
 
Old 06-19-2003, 03:38 PM   #5
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Quote:
Originally posted by acid_kewpie
but how?
Create a table with a full width row containing a DIV with an id - set the width to 100%:
Code:
<TABLE>
<TR colspan="2"><div id="width" style="width:100%;height:1"></div></TD></TR>
<TR><TD>Cell 1</TD><TD>Cell 2</TD></TR>
</TABLE>
Then to read the width to a variable (will be in pixels):
Code:
var width = document.all('width').clientWidth;
You could also do the same thing with a blank gif or somehting instead of a DIV.
 
Old 06-20-2003, 05:24 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Original Poster
Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
ahh that's great. i'm still originally opening the popup first time to a guarenteed larger size, but on the whole that's a great impreovemtn, thanks!

Last edited by acid_kewpie; 06-20-2003 at 05:36 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
three- level page table in linux 2.6 mehrotraamit-2 Linux - Newbie 1 11-15-2005 10:19 AM
html page maker prabhakar_kushwaha Linux - Software 3 10-14-2005 09:17 PM
HTML: attribute height in tag table jaakkop Programming 4 03-22-2005 07:29 AM
changing an HTML table with javascript eantoranz Programming 2 10-29-2004 12:21 PM
HTML page break? patpawlowski Programming 4 02-12-2004 10:30 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration