Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    cmc
    cmc is offline
    New to the CF scene
    Join Date
    May 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Overflow-y: scroll position

    I have the following tag inside an html table:

    <td><div style='height:300px; overflow-x:hidden; overflow-y:scroll'><table><tr>

    <td>Row-1</td>
    <tr></tr>
    <td>Row-2</td>
    <tr></tr>
    <td>Row-3</td>
    <tr></tr>
    <td>Row-4</td>

    etc...

    This gives me a scrollable table with the scroll position set to the first row. Is the a way to make the scroll position be set to have the second, third, etc. row at the top instead of the first row.

    tia,
    cmc

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Posts
    301
    Thanks
    7
    Thanked 2 Times in 2 Posts
    I am not sure that is clear enough for me to understand. At a rough glance it looks incomplete or invalid code. Can we see a link to the page please where we can look at the entire code.

    Ta.

  • #3
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    This should get you off in the right start.
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script type="text/javascript">
    <!--
    function scroller(){
    var elem = document.getElementById('main');
    howhigh= (elem.scrollHeight)/4;
    elem.scrollTop = howhigh;
    }
    //-->
    </script>
    </head>
    
    <body onload="scroller()">
    <div id="main" style="height:300px;overflow:auto;">
    	<table style="height:600px;width:98%;margin:auto;">
    	<tr>
    		<td>Row-1</td>
    	<tr>
    		<td>Row-2</td>
    	</tr>
    	<tr>
    		<td>Row-3</td>
    	</tr>
    	<tr>
    		<td>Row-4</td>
    	</tr>
    	</table>
    </div>
    </body>
    </html>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •