Link to home
Start Free TrialLog in
Avatar of dciucci
dciucci

asked on

Table with "absolute" total lines at bottom

First of all, I'm very new to Web Development so please excuse my terminology.
I'm trying to create a page that will read info from a database into a table. At the bottom of the page, I want a total amount line that is always visible no matter the length of the table above it. So......  I need scroll bars on the table. I have the <div></div> and using a style sheet, etc. I'm not sure which way to go with this.  I'm also familiar with style sheets and have tried using them.
What I have SO FAR is this :
      <center>
      <table bgcolor="linen" name="testtable" id="testtable" height="20%" width="95%" cellpadding="0" cellspacing="0" border="1" rules="cols" style="BACKGROUND-IMAGE: none;">
      <tr>
            <table bgcolor="linen" name="testtable" id="testtable" height="20%" width="95%" cellpadding="0" cellspacing="0" border="1" rules="cols" style="BACKGROUND-IMAGE: none;">
            <div class=DivTable id=WorkListTable>
<%
      set oCN = server.CreateObject("ADODB.Connection")
      set oRS = server.CreateObject("ADODB.Recordset")
      oCN.Open "Driver={SQL Server};server=xxx;database=xxx;uid=xx;pwd=xx"
      set ors = oCN.Execute("Select * from tblclaims")
%>  
            <%do until ors.EOF %>
            <%trid="tr" & cstr(oRS("ClaimID"))%>
                  <tr name="<%=trid%>" id="<%=trid%>">
                        <td><A class=RevText href="javascript:highlight(<%=trid%>,3)" id="a<%=trid%>1" name="a<% =trid%>1" style="TEXT-DECORATION: none" title="Click to Select" ><font size=2><%=oRS("ClaimDate")%></A></TD>
                        <td><A class=RevText href="javascript:highlight(<%=trid%>,3)" id="a<%=trid%>2" name="a<% =trid%>2" style="TEXT-DECORATION: none" title="Click to Select" ><font size=2><%=oRS("InvoiceNumber")%></A></TD>
                        <td><A class=RevText href="javascript:highlight(<%=trid%>,3)" id="a<%=trid%>3" name="a<% =trid%>3" style="TEXT-DECORATION: none" title="Click to Select" ><font size=2><%=trim(oRS("lastname")) & ", " & trim(oRS("firstname")) & trim(ors("middleinitial"))%></A></TD>
                  </TR>

            <%ors.movenext
            loop
            Set ors = Nothing
            Set ocn = Nothing
            %>
            </div>
            </table>
      </tr>
      </TABLE>
      <!-- The following table is for the total line-->
      <TABLE WIDTH=95% BGCOLOR=Linen ALIGN=center BORDER=0 CELLSPACING=1 CELLPADDING=5>
      <div id=Footer>
      <TR>
            <TD align="right"><font class=RevText size=3><b>Total Rejected Amount:</b></font></TD>
            <TD><INPUT type="text" id=text1 name=text1></TD>
            <TD align="right"><font class=RevText size=3><b>Rejections Outstanding</b></font></TD>
            <TD><INPUT type="text" id=text1 name=text1></TD>
      </TR>
      </div>
      </TABLE>
      </CENTER>
      <script for=window event=onscroll LANGUAGE="JScript">
      srs101();
      </script>
      <script LANGUAGE="JavaScript">
      
      function srs101() {
            with (document.body){
//                  RCWorkListTable.style.top=scrollTop+100;
            }
      }
      
            
      </script>
Avatar of dciucci
dciucci

ASKER

FYI-The RCWorkListTable in the srs101 function is a typo. It should read WorkListTable.
The way you have it will work with having the totals at the bottom of the table no matter what... To get the totals, you can use a count in you sql string, or create a counter in your loop so that everytime it loops to increment the counter + 1

<%
Counter = Counter + 1
ors.movenext
loop
Set ors = Nothing
Set ocn = Nothing
%>

Then in your totals table, just call the counter variable...

<% =Counter %>

Hope this helps
Avatar of dciucci

ASKER

Yes that helps ( I haven't even gotten to putting in a counter and the "total dollar amount" variable. In my testing, you don't even see the total line until you scroll down to the end of the table....   For example, you only can see 10 of the 30 lines in the table ... you don't see the total line at all until you scroll down past all 30 lines...... I want the total line to be visible all of the time. (absolute).  I will be putting this page in a frame in another web page.......
dciucci: if you're really up for a challenge, try using the HTML 4.0 extended table model, and create a set footer for your table that stays put.  only problem is that you'll have to download Mozilla to view it properly. :-)

the table spec's at http://www.w3.org/TR/html4/struct/tables.html and Mozilla can be downloaded from http://www.mozilla.org/
Although it may seem a little far afield, it sounds like what you want/need to do amounts to making the total row into some sort of "watermark", which retains its position on the page.

Check out www.webreference.com/dhtml and www.brainjar.com.  Webreference has code for a watermark and brainjar has a navigation bar which moves down the page as you scroll.

I don't know if this code will be compatible with what you need, but it might give you enough to work it out.

Tom
ASKER CERTIFIED SOLUTION
Avatar of radzi
radzi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
the IFRAME element, even though found in HTML 4.0, is not supported by Netscape nor Opera.
Avatar of dciucci

ASKER

I had thought of using frames at the beginning but wasn't sure how to take the total from the frame with the table and get it to the "total" text area in the next frame........  I guess that will be the subject of my next question. I do need to be concerned with browser compatibility and also our clients will need to view these pages so I was concerned about them downloading Mozilla (or whatever it was called.) I assume I'm doing the point thing correctly by awarding the points to the person whose suggestion I took???
Exactly!

Tom