scrolling a div

Discussion in 'Javascript' started by Simon Wigzell, Aug 28, 2005.

  1. I have a simple page where the user adds a comment to a form that gets saved
    in a database, the page refreshes and reads the contents of the database and
    displays them inside a scrolling div.

    The following piece of code simulates some text inside a div where the text
    is longer than the div is high. I would like to force the display to the end
    of the - as if the user had scrolled to the end - when the page refreshes.

    What is the property of the div that controls the position of the text
    inside it and how do I set this to the end with javascript? IF this was a
    text area then I could just say:

    document.all.Comments.scrollHeight = 10000;

    I think. I am using a div instead of a text area because the text I am
    displaying will contain html.

    Thanks!

    <div id="Comments" style="background-color: #FFFFDD; border: inset 2px
    #999999; overflow:auto; width=200; height=100;">
    Some Text<br>
    Some Text<br>
    Some Text<br>
    Some Text<br>
    Some Text<br>
    Some Text<br>
    Some Text<br>
    Some Text<br>
    Some Text<br>
    Some Text<br>
    Some Text<br>
    Some Text<br>
    Some Text<br>
    Some Text<br>
    Some Text<br>
    Some Text<br>
    </div>
     
    Simon Wigzell, Aug 28, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?=

    datagrid in a div for scrolling question

    =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?=, Aug 26, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    567
    jasonkester
    Aug 26, 2005
  2. stan
    Replies:
    0
    Views:
    454
  3. K Viltersten

    <div ... /> and <div ...></div>

    K Viltersten, Mar 30, 2009, in forum: ASP .Net
    Replies:
    4
    Views:
    775
  4. Dwayne Madsen

    Q: Div A inside Div B is larger than Div B

    Dwayne Madsen, Jun 1, 2005, in forum: Javascript
    Replies:
    1
    Views:
    206
    David Dorward
    Jun 1, 2005
  5. mscir
    Replies:
    3
    Views:
    334
    Martin Honnen
    Jun 26, 2005
Loading...

Share This Page