Results 1 to 3 of 3

Thread: A DIV area critical situation

  1. #1
    Join Date
    Apr 2007
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default A DIV area critical situation

    Hi

    I have a Normal Div area
    It contains Text inside it

    <div style="width:300px;height:300px;overflow:auto;border-width:0px;border-color:000000;border-style:solid;">
    Text is here
    Text is here
    Text is here
    </div>

    I want when the page is loaded, this div area shows the bottom automatically
    i.e. The last Line

    I dont want users to scroll down this little div area everytime page is loaded

    Do you know how this can be done?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Your example division will have no scrollbars. However, given enough content, it would and the default scroll position would be 0 or at the top. To scroll it using javascript, use the scrollTop property:

    Code:
    <div id="myDiv" style="width:300px;height:300px;overflow:auto;border-width:0px;border-color:#000000;border-style:solid;">
    Text is here
    Text is here
    Text is here
    </div>
    <script type="text/javascript">
    onload=function(){setTimeout("document.getElementById('myDiv').scrollTop=30000",100);};
    </script>
    No point in having a border with border-width:0px; but, if you do, you need the hash mark before the color number:

    #000000

    not:

    000000
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Apr 2007
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks
    it works perfect

Bookmarks

Posting Permissions

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