Solved

I.E 5.5 and scrolling table

Posted on 2002-05-22
10
285 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This article discusses four methods for overlaying images in a container on a web page
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now