Solved

I.E 5.5 and scrolling table

Posted on 2002-05-22
10
306 Views
Last Modified: 2010-04-09
I want to create a table with stationary headers and footers but with a scrollable body. Scroll bars have to be on both the left and right sides of the body.
0
Comment
Question by:Finnbin
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 7027623
if you don't mind using IFrames, you can do this:


<HTML>
<BODY>
<CENTER>

<TABLE border='1' cellpadding='0' cellspacing='0'>
 <TR>
  <TH>Heading 1</th>
  <TH>Heading 2</th>
  <TH>Heading 3</th>
  <TH>Heading 4</th>
  <TH comment='this is the scrollbar spacer'>&nbsp;&nbsp;&nbsp;</th>
 </tr>
 <TR>
  <TD colspan='5'><IFRAME name='myIFrame' id='myIFrame' src='myTable.htm' border='0' frameborder='0' marginwidth='0' marginheight='0' ></iframe></td>
 </tr>
 <TR>
  <TH>Footer 1</th>
  <TH>Footer 2</th>
  <TH>Footer 3</th>
  <TH>Footer 4</th>
  <TH></th>
 </tr>
</table>

</center>
</body>
</html>




then put this in myTable.htm:


<HTML>
<BODY marginheight="0" marginwidth="0">
<CENTER>

<TABLE border='1' width='100%'  cellpadding='0' cellspacing='0'>
 <TR width='100%'>
  <TD>data 1-1</td>
  <TD>data 1-2</td>
  <TD>data 1-3</td>
  <TD>data 1-4</td>
 </tr>
 <TR>
  <TD>data 2-1</td>
  <TD>data 2-2</td>
  <TD>data 2-3</td>
  <TD>data 2-4</td>
 </tr>
 <TR>
  <TD>data 3-1</td>
  <TD>data 3-2</td>
  <TD>data 3-3</td>
  <TD>data 3-4</td>
 </tr>
 <TR>
  <TD>data 4-1</td>
  <TD>data 4-2</td>
  <TD>data 4-3</td>
  <TD>data 4-4</td>
 </tr>
 <TR>
  <TD>data 5-1</td>
  <TD>data 5-2</td>
  <TD>data 5-3</td>
  <TD>data 5-4</td>
 </tr>
 <TR>
  <TD>data 6-1</td>
  <TD>data 6-2</td>
  <TD>data 6-3</td>
  <TD>data 6-4</td>
 </tr>
 <TR>
  <TD>data 7-1</td>
  <TD>data 7-2</td>
  <TD>data 7-3</td>
  <TD>data 7-4</td>
 </tr>
 <TR>
  <TD>data 8-1</td>
  <TD>data 8-2</td>
  <TD>data 8-3</td>
  <TD>data 8-4</td>
 </tr>
 <TR>
  <TD>data 9-1</td>
  <TD>data 9-2</td>
  <TD>data 9-3</td>
  <TD>data 9-4</td>
 </tr>
</table>

</center>
</body>
</html>
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 7027647
and this is an improvement (specifying width for each column)


<HTML>
<BODY>
<CENTER>

<TABLE border='1' cellpadding='0' cellspacing='0'>
 <TR>
  <TH width='160' nowrap>&nbsp; Heading 1 &nbsp;</th>
  <TH width='160' nowrap>&nbsp; Heading 2 &nbsp;</th>
  <TH width='160' nowrap>&nbsp; Heading 3 &nbsp;</th>
  <TH width='160' nowrap>&nbsp; Heading 4 &nbsp;</th>
  <TH width='15'  comment='this is the scrollbar spacer'>&nbsp;</th>
 </tr>
 <TR>
  <TD colspan='5'><IFRAME name='myIFrame' id='myIFrame' src='myTable.htm' width='100%' border='0' frameborder='0' marginwidth='0' marginheight='0' ></iframe></td>
 </tr>
 <TR>
  <TH>Footer 1</th>
  <TH>Footer 2</th>
  <TH>Footer 3</th>
  <TH>Footer 4</th>
  <TH></th>
 </tr>
</table>

</center>
</body>
</html>



myTable.htm:

<HTML>
<BODY marginheight="0" marginwidth="0">
<CENTER>

<TABLE border='1' width='100%'  cellpadding='0' cellspacing='0'>
 <TR width='100%'>
  <TD width='160'>data 1-1</td>
  <TD width='160'>data 1-2</td>
  <TD width='160'>data 1-3</td>
  <TD width='160'>data 1-4</td>
 </tr>
 <TR>
  <TD>data 2-1</td>
  <TD>data 2-2</td>
  <TD>data 2-3</td>
  <TD>data 2-4</td>
 </tr>
 <TR>
  <TD>data 3-1</td>
  <TD>data 3-2</td>
  <TD>data 3-3</td>
  <TD>data 3-4</td>
 </tr>
 <TR>
  <TD>data 4-1</td>
  <TD>data 4-2</td>
  <TD>data 4-3</td>
  <TD>data 4-4</td>
 </tr>
 <TR>
  <TD>data 5-1</td>
  <TD>data 5-2</td>
  <TD>data 5-3</td>
  <TD>data 5-4</td>
 </tr>
 <TR>
  <TD>data 6-1</td>
  <TD>data 6-2</td>
  <TD>data 6-3</td>
  <TD>data 6-4</td>
 </tr>
 <TR>
  <TD>data 7-1</td>
  <TD>data 7-2</td>
  <TD>data 7-3</td>
  <TD>data 7-4</td>
 </tr>
 <TR>
  <TD>data 8-1</td>
  <TD>data 8-2</td>
  <TD>data 8-3</td>
  <TD>data 8-4</td>
 </tr>
 <TR>
  <TD>data 9-1</td>
  <TD>data 9-2</td>
  <TD>data 9-3</td>
  <TD>data 9-4</td>
 </tr>
</table>

</center>
</body>
</html>
0
 
LVL 23

Accepted Solution

by:
b1xml2 earned 150 total points
ID: 7034252
The following does not require IFRAMES and thus can be placed on the main page. It uses MSIE5+ specific functionality.

<html>
<head>
<title>Scrolling</title>
<style>
table {table-layout:fixed-layout;width:100%;}
body, table td, table th {font-family:Verdana;font-size:9pt;}
.header, .footer, .body {text-align:center;}
.body1 {text-align:right;padding-right:5px;}
#header, #footer {border:1px solid #000000;background:#ee82ee;}
div {width:100%;}
</style>
<script language="javascript">
window.onload = init;
function init() {
  document.getElementById("content").style.setExpression("height","document.body.clientHeight - document.all.header.offsetHeight - document.all.footer.offsetHeight");
}
</script>
</head>
<body scroll="no" style="scrollbar-base-color:#ee82ee;margin:0px;">
<table cellpadding="4" cellspacing="2" id="header">
<col width="20%" class="header">
<col width="20%" class="header">
<col width="20%" class="header">
<col width="20%" class="header">
<col width="20%" class="header">
<tr>
<td nowrap>SKU</td>
<td nowrap>Date</td>
<td nowrap>Transaction ID</td>
<td nowrap>Buyer ID</td>
<td nowrap>Transaction ($)</td>
</tr>
<tr>
 <td nowrap style="font-size:1px;height:1px;padding:0px;" colspan="5"><div style="width:450px;height:1px;overflow:hidden;"></div></td>
</tr>
</table>
<div id="content" style="height:300px;overflow:auto;">
<table cellpadding="4" cellspacing="2">
<col width="20%" class="body">
<col width="20%" class="body">
<col width="20%" class="body">
<col width="20%" class="body">
<col width="20%" class="body1">
<tr>
  <td nowrap>234516</td>
  <td nowrap>2002-03-12T13:45</td>
  <td nowrap>234568</td>
  <td nowrap>FGER345</td>
  <td nowrap>234.56</td>
</tr>
<tr>
  <td nowrap>234517</td>
  <td nowrap>2002-03-12T14:56</td>
  <td nowrap>234569</td>
  <td nowrap>ARET956</td>
  <td nowrap>1,034.56</td>
</tr>
<tr>
  <td nowrap>234518</td>
  <td nowrap>2002-03-12T15:30</td>
  <td nowrap>234568</td>
  <td nowrap>ZIYU023</td>
  <td nowrap>1,4536.01</td>
</tr>
<tr>
  <td nowrap>234518</td>
  <td nowrap>2002-03-12T15:30</td>
  <td nowrap>234568</td>
  <td nowrap>ZIYU023</td>
  <td nowrap>1,4536.01</td>
</tr>
<tr>
  <td nowrap>234518</td>
  <td nowrap>2002-03-12T15:30</td>
  <td nowrap>234568</td>
  <td nowrap>ZIYU023</td>
  <td nowrap>1,4536.01</td>
</tr>
<tr>
  <td nowrap>234518</td>
  <td nowrap>2002-03-12T15:30</td>
  <td nowrap>234568</td>
  <td nowrap>ZIYU023</td>
  <td nowrap>1,4536.01</td>
</tr>
<tr>
  <td nowrap>234518</td>
  <td nowrap>2002-03-12T15:30</td>
  <td nowrap>234568</td>
  <td nowrap>ZIYU023</td>
  <td nowrap>1,4536.01</td>
</tr>
<tr>
  <td nowrap>234518</td>
  <td nowrap>2002-03-12T15:30</td>
  <td nowrap>234568</td>
  <td nowrap>ZIYU023</td>
  <td nowrap>1,4536.01</td>
</tr>
<tr>
  <td nowrap>234518</td>
  <td nowrap>2002-03-12T15:30</td>
  <td nowrap>234568</td>
  <td nowrap>ZIYU023</td>
  <td nowrap>1,4536.01</td>
</tr>
<tr>
  <td nowrap>234518</td>
  <td nowrap>2002-03-12T15:30</td>
  <td nowrap>234568</td>
  <td nowrap>ZIYU023</td>
  <td nowrap>1,4536.01</td>
</tr>
<tr>
 <td nowrap style="font-size:1px;height:1px;padding:0px;" colspan="5"><div style="width:440px;height:1px;overflow:hidden;"></div></td>
</tr>
</table>
</div>
<table cellpadding="4" cellspacing="2" id="footer">
<col width="20%" class="footer">
<col width="20%" class="footer">
<col width="20%" class="footer">
<col width="20%" class="footer">
<col width="20%" class="footer">
<tr>
<td nowrap>SKU</td>
<td nowrap>Date</td>
<td nowrap>Transaction ID</td>
<td nowrap>Buyer ID</td>
<td nowrap>Transaction ($)</td>
</tr>
<tr>
  <td nowrap style="font-size:1px;height:1px;padding:0px;" colspan="5"><div style="width:450px;height:1px;overflow:hidden;"></div></td>
</tr>
</table>
</body>
</html>
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 23

Expert Comment

by:b1xml2
ID: 7034255
Notes
=====
The functionality in the HTML Page can be made MSIE 4 compatible as well.

Usage
=====
1. CSS Property overflow. Value: auto
2. MSIE HTML Scroll Attribute On Body. Value: no
3. MSIE5+ CSS Property scrollbar-base-color.
4. A hidden div on each 3 tables with the same settings. This allows for the relevant scroll bar to appear.
5. CSS Property table-layout. Value: fixed
This allows for the three tables to sync in size when used with #4.
6. Usage of MSIE5+ Only DOM Method:
 element.style.setExpression(<property>,<expression>);
7. Initial value of 300px for height which will be changed by #6.
8. The change is effected by calculating
a. the current height available for the client - document.body.clientHeight
b. the current height of the header -
document.all.header.offsetHeight
c. the current height of the footer
document.all.footer.offsetHeight
0
 
LVL 2

Author Comment

by:Finnbin
ID: 7042023
Good answers from both guys, just don't know which one to pick. Will go with KnightEKnight because he was in first.
Thanks for the help.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7116645
This question has been abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
   In the absence of responses, I will recommend DELETE unless it is clear
   to me that it has value as a PAQ.  Silence = you don't care
</note>

Cd&
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 7122992
Don't delete ... Finnbin has already stated that the answers provided are good, so why would you delete this instead of offering points?
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7123216
kEk,

A delete would only happen if there is no clear value in the PAQ.  The post is a cut and paste ping, intended to get recommendations.  When there are no recommendations it is more work for me and the mods to get them cleaned up.  If we were using the autograde/autodelete we would hvae lost tens of thousands of good PAQs.  

This way is a lot of work but if we can get recommendations and save the Qs, it is worth it.

Cd&
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 7123229
OK Cd& ...
"value as a PAQ" is a subjective term -- there are many repeated Q-and-A's in the PAQ.  Anyway, if I believe I have made a significant effort or contribution on a given question, I'll just leave a "please don't delete" comment -- so as not to be "silent" about it.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7123266
Yeah, delete is sort of the default if no one wants to keep it.  Like the old autodelete.

Cd&
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question