Scrollable div with height=100%

I try to make a page that will have a long table, and a title above the table, and I want the table to be scrollable WITHOUT scrolling the title. In other ways, I want a fix title and a scrollable table. the way I see it I can use either frames or scrollable DIVs. I preffer scrollable because this entire page is already in two sets of frameset. SO, the problem is, that if I set a fixed height to the DIV, everything is fine, BUT if a set the DIV height to 100% and the top to be 22px, the DIV spreads itself to the entire size of the frame but because it starts 22px form the top, it overflows 22px from the bottom, so the end of the scrollbar is unreachable.
here is the code: (open it in browser, and make the window smaller then the table - which I made shorter for the question - then you'll see the problem)

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Asset List</title>
<link rel="stylesheet" href="/XmpieSite/Utils/mainstyle.css" type="text/css">
<SCRIPT language="JavaScript" SRC="/Utils/XMPiEScripts.js">
</script>
</head>

      <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >
    <div id="Buttons" style="position:absolute;top:0;overflow-X:hidden;overflow-y:hidden;width:100%;height:22;z-index:1">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr bgcolor=#003399>
                  <td nowrap class="sectionHead" valign="middle">&nbsp;Campaign Assets</td>
                  <td nowrap align="right" valign="middle">
                        <table border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                    <td><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('openbtn','','../../images/open-over.gif',1)"><img alt="Open Asset" name="openbtn" border="0" src="../../images/open.gif" width="75" height="21" onClick="AssetOpen.submit();"></a></td>              
                                    <td><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('deletebtn','','../../images/delete-over.gif',1)"><img alt="Delete Asset" name="deletebtn" border="0" src="../../images/delete.gif" width="75" height="21" onClick="confirmFormSubmition(AssetDelete,'Asset')"></a></td>
                                    <td><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('newbtn','','../../images/new-over.gif',1)"><img alt="New Asset" name="newbtn" border="0" src="../../images/new.gif" width="75" height="21" onClick="AssetNew.submit();"></a></td>
                              </tr>
                        </table>
                  </td>
            </tr>
      </table>
      </div>
      <div id="tableDiv" style="position:absolute;top:22;overflow-X:visible;overflow-y:auto;width:100%;height:100%;">
            <table width="100%" border="0" cellspacing="2" cellpadding="0">
                  <tr>
                        <td nowrap width="24" align="center">&nbsp;</td>
                        <td nowrap class="listHeader"><img src="../../images/sort.gif" width="16" height="16" align="absmiddle"><a href="#">Asset</a></td>
                        <!--<td nowrap class="listHeader"><img src="../../images/sort-no.gif" width="16" height="16" align="absmiddle"><a href="#">Type</a></td>
                        <td nowrap class="listHeader"><img src="../../images/sort-no.gif" width="16" height="16" align="absmiddle"><a href="#">Size</a></td>
                        <td nowrap class="listHeader"><img src="../../images/sort-no.gif" width="16" height="16" align="absmiddle"><a href="#">Upload Date</a></td> -->
                  </tr>

                  <tr>
                        <td nowrap width="24" align="center" class="listtext"><img src="../../images/nodes/listicons/unknown.gif" width="16" height="16"></td>
                        <td nowrap class="listtext"><a href="javascript:setAssetDetails(1,'bouquet1.jpg','//ZVIKA/XMPiEData/1/3/assets//bouquet1.jpg', AssetOpen, AssetSelect)" ondblclick="setAssetDetails(1,'bouquet1.jpg','//ZVIKA/XMPiEData/1/3/assets//bouquet1.jpg', AssetOpen, AssetSelect)">bouquet1.jpg</a></td>
                        <!--<td nowrap class="listtext"><a href="#" target="ComponentDetails" onClick="setAssetDetails(1,'bouquet1.jpg','//ZVIKA/XMPiEData/1/3/assets//bouquet1.jpg')">bouquet1.jpg</a></td>
                        <td nowrap class="listtext">JPEG Image</td>
                        <td nowrap class="listtext">145kb</td>
                        <td nowrap class="listtext">07-Jul-2001 10:32</td> -->
                  </tr>

                  <tr>
                        <td nowrap width="24" align="center" class="listtext"><img src="../../images/nodes/listicons/unknown.gif" width="16" height="16"></td>
                        <td nowrap class="listtext"><a href="javascript:setAssetDetails(2,'bouquet2.jpg','//ZVIKA/XMPiEData/1/3/assets//bouquet2.jpg', AssetOpen, AssetSelect)" ondblclick="setAssetDetails(2,'bouquet2.jpg','//ZVIKA/XMPiEData/1/3/assets//bouquet2.jpg', AssetOpen, AssetSelect)">bouquet2.jpg</a></td>
                        <!--<td nowrap class="listtext"><a href="#" target="ComponentDetails" onClick="setAssetDetails(2,'bouquet2.jpg','//ZVIKA/XMPiEData/1/3/assets//bouquet2.jpg')">bouquet2.jpg</a></td>
                        <td nowrap class="listtext">JPEG Image</td>
                        <td nowrap class="listtext">145kb</td>
                        <td nowrap class="listtext">07-Jul-2001 10:32</td> -->
                  </tr>

                  <tr>
                        <td nowrap width="24" align="center" class="listtext"><img src="../../images/nodes/listicons/unknown.gif" width="16" height="16"></td>
                        <td nowrap class="listtext"><a href="javascript:setAssetDetails(3,'bouquet3.jpg','//ZVIKA/XMPiEData/1/3/assets//bouquet3.jpg', AssetOpen, AssetSelect)" ondblclick="setAssetDetails(3,'bouquet3.jpg','//ZVIKA/XMPiEData/1/3/assets//bouquet3.jpg', AssetOpen, AssetSelect)">bouquet3.jpg</a></td>
                        <!--<td nowrap class="listtext"><a href="#" target="ComponentDetails" onClick="setAssetDetails(3,'bouquet3.jpg','//ZVIKA/XMPiEData/1/3/assets//bouquet3.jpg')">bouquet3.jpg</a></td>
                        <td nowrap class="listtext">JPEG Image</td>
                        <td nowrap class="listtext">145kb</td>
                        <td nowrap class="listtext">07-Jul-2001 10:32</td> -->
                  </tr>

                  <tr>
                        <td nowrap width="24" align="center" class="listtext"><img src="../../images/nodes/listicons/unknown.gif" width="16" height="16"></td>
                        <td nowrap class="listtext"><a href="javascript:setAssetDetails(4,'bouquet4.jpg','//ZVIKA/XMPiEData/1/3/assets//bouquet4.jpg', AssetOpen, AssetSelect)" ondblclick="setAssetDetails(4,'bouquet4.jpg','//ZVIKA/XMPiEData/1/3/assets//bouquet4.jpg', AssetOpen, AssetSelect)">bouquet4.jpg</a></td>
                        <!--<td nowrap class="listtext"><a href="#" target="ComponentDetails" onClick="setAssetDetails(4,'bouquet4.jpg','//ZVIKA/XMPiEData/1/3/assets//bouquet4.jpg')">bouquet4.jpg</a></td>
                        <td nowrap class="listtext">JPEG Image</td>
                        <td nowrap class="listtext">145kb</td>
                        <td nowrap class="listtext">07-Jul-2001 10:32</td> -->
                  </tr>

                  <tr>
                        <td nowrap width="24" align="center" class="listtext"><img src="../../images/nodes/listicons/unknown.gif" width="16" height="16"></td>
                        <td nowrap class="listtext"><a href="javascript:setAssetDetails(5,'bouquet5.jpg','//ZVIKA/XMPiEData/1/3/assets//bouquet5.jpg', AssetOpen, AssetSelect)" ondblclick="setAssetDetails(5,'bouquet5.jpg','//ZVIKA/XMPiEData/1/3/assets//bouquet5.jpg', AssetOpen, AssetSelect)">bouquet5.jpg</a></td>
                        <!--<td nowrap class="listtext"><a href="#" target="ComponentDetails" onClick="setAssetDetails(5,'bouquet5.jpg','//ZVIKA/XMPiEData/1/3/assets//bouquet5.jpg')">bouquet5.jpg</a></td>
                        <td nowrap class="listtext">JPEG Image</td>
                        <td nowrap class="listtext">145kb</td>
                        <td nowrap class="listtext">07-Jul-2001 10:32</td> -->
                  </tr>

                  <tr>
                        <td nowrap width="24" align="center" class="listtext"><img src="../../images/nodes/listicons/unknown.gif" width="16" height="16"></td>
                        <td nowrap class="listtext"><a href="javascript:setAssetDetails(6,'bouquet6.jpg','//ZVIKA/XMPiEData/1/3/assets//bouquet6.jpg', AssetOpen, AssetSelect)" ondblclick="setAssetDetails(6,'bouquet6.jpg','//ZVIKA/XMPiEData/1/3/assets//bouquet6.jpg', AssetOpen, AssetSelect)">bouquet6.jpg</a></td>
                        <!--<td nowrap class="listtext"><a href="#" target="ComponentDetails" onClick="setAssetDetails(6,'bouquet6.jpg','//ZVIKA/XMPiEData/1/3/assets//bouquet6.jpg')">bouquet6.jpg</a></td>
                        <td nowrap class="listtext">JPEG Image</td>
                        <td nowrap class="listtext">145kb</td>
                        <td nowrap class="listtext">07-Jul-2001 10:32</td> -->
                  </tr>

                  <tr>
                        <td nowrap width="24" align="center" class="listtext"><img src="../../images/nodes/listicons/unknown.gif" width="16" height="16"></td>
                        <td nowrap class="listtext"><a href="javascript:setAssetDetails(7,'bouquet7.jpg','//ZVIKA/XMPiEData/1/3/assets//bouquet7.jpg', AssetOpen, AssetSelect)" ondblclick="setAssetDetails(7,'bouquet7.jpg','//ZVIKA/XMPiEData/1/3/assets//bouquet7.jpg', AssetOpen, AssetSelect)">bouquet7.jpg</a></td>
                        <!--<td nowrap class="listtext"><a href="#" target="ComponentDetails" onClick="setAssetDetails(7,'bouquet7.jpg','//ZVIKA/XMPiEData/1/3/assets//bouquet7.jpg')">bouquet7.jpg</a></td>
                        <td nowrap class="listtext">JPEG Image</td>
                        <td nowrap class="listtext">145kb</td>
                        <td nowrap class="listtext">07-Jul-2001 10:32</td> -->
                  </tr>

            </table>      
      </div>
</body>
</html>
LVL 4
ZvikaAsked:
Who is Participating?
 
COBOLdinosaurConnect With a Mentor Commented:
IE 5+ no problem.
Netscrap 6+  I'm not sure if it even supports overflow. If it does then you will probably need to use window.innerHeight to get the page height, and no guarantees on whether you have to make different adjustments for IE and Netscrap.

As for MAC... anything on a MAC is a crap shoot you don't know what will work until you try it.  I don't support MAC, I don't what it will let you do with this.

Cd&
0
 
DreamMasterCommented:
Hmmm...first of all...

The way you are doing this now you will never get the button div to stay where it is...it will move along with the scrollbar...as far as I know overflow is only really supported on the body tag, could be wrong there though

There are other types of solutions to do what you want to do...scrollable layers are very well doable...

Just have a look at:

http://www.thekitchen.nl/default.asp?Page=/welkom/main.asp

See in the middle of the screen...there is text there and it is scrolled by going over 2 small arrows at the right side of it, if this is more like what you want I can make an easier version of it for you so you could use that...

Max.
0
 
Göran AnderssonCommented:
You could simply set the height of the div to 90%. That works as long as the page is more than 220 pixels high. There will be a small unused area at the bottom of the page, but at least that's better than having an overflow...

You could also write a javascript function that sets the height of the div to the available height minus the height of the title and borders. Put a call to the function in the body onload event and the window resizeend event. This will be quite browser-specific, though...
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
ZvikaAuthor Commented:
GreenGhost
I thoght about both of your ideas and tried them before posting this question. The thing is, that that page is one frame in a frame set that is resizeable, so 90% (or any other compremised %) is not good enough, because the user may resize it to anything between 0 to 800 px.
This is also true for your second idea - I made a script that fix it in OnLoad, but afterwards, if the user changes the frameset sizes, or the entire explorer window size - the problem will occur.

Any other ideas?
(and - is that the right behaviour for 100% height?)
0
 
COBOLdinosaurCommented:
You will not get it to work correct with height expressed as a percentage.  if you want the div to be scrollabe and work correctly you have three requirements and a limitation.

The limitation is IE only.  The requirements: It must be absolutely positioned;  It must specify overflow-y:scroll or overflow-y:auto; and it must have a fixed height in pixels.

You can change the height dynamically with scriping, but if you use a percentage you can play around with it all you want; you will not get it to work reliably.  I have don hundreds of scrolling divs what you want is simple within the limits of the technology, but it is very easy to break. The percentage is a percentage of the total window, , not what is left so no matter what you do and no matter what percentage you use, it is not going to show the way you want it too for all sizes and resolutions.

Cd&



Cd&
0
 
ZvikaAuthor Commented:
Cd&
How can I change the height dynamicly? I should do it if the user changes the window size, or the framesset division... Do you have some hints for me?
0
 
ZvikaAuthor Commented:
Cd&
How can I change the height dynamicly? I should do it if the user changes the window size, or the framesset division... Do you have some hints for me?
0
 
COBOLdinosaurCommented:
In the head of the page:

<script language="JavaScript">
<!--
   function resetHgt()
   {
      document.getElementById('tableDiv').style.height=document.body.clientHeight-22;
   }
//-->
</script>

Then in the body tag:

<body onLoad="resetHgt()" onResize="resetHgt()">

That should keep it 22px from the top with a height equal t the res of the page.  It might need an adjustment of a few pixels depending on the margin settings.

Cd&
0
 
ZvikaAuthor Commented:
This will only work in IE on Windows I guess...
Right?
(I need at least IE 5+, NN 6+ for both MAC & WIN)

0
 
ZvikaAuthor Commented:
Thanks Cd&.
I couldn't graded you with an A, as it is actually a workaround, not a solution, plus the fact that I should still make some research for Mac, & Netscape.
0
 
COBOLdinosaurCommented:
If there was a perfect solution.  I would have given it to you.  If a workaround is the best solution then you sitll got the best possible answer, whether you like the limits of the technology or not.  

I see no point in trying to help you in the future, because you did not grade my solution, but the limits of the technology.  Send you complaints to Microsoft and Netscrap.  I didn't invent the technology.

Cd&
0
 
ZvikaAuthor Commented:
Cd&
You read only the first part of my comment.

>> plus the fact that I should still make
>> some research for Mac, & Netscape.

as your solution was only for IE 5+ in Win, though I needed NN 6+ for Win and IE 5+ & NN 6+ for Mac. So I graded your solution, which is probably the best there is in the technology, but gavr you B as this is only partial answer (1/4 of what I need - one browwser out of four).

Please don't be so rude... (not to me, and even not to Apple & Netscape - or actually Mozilla)
0
All Courses

From novice to tech pro — start learning today.