content loads half-way scrolled down, not at top

Discussion in 'JavaScript' started by aricknophobia, May 9, 2007.

  1. #1
    Hello

    I'm having some trouble with scrollbars and loading pages.

    When the user clicks on buttons, content loads into another div, using javascript/iframes to call separate html files. That all works fine. But if you scroll down the loaded content, and then click another button (the buttons are housed in a separate div), the new content loaded will be partially scrolled down already, and I would like it to load at the TOP! The scrollbars are setup simply using CSS overflow=auto feature.

    I have tried a few solutions to no avail:


    1. In the html files that are called when the user clicks the buttons, I have tried

    
    <body onLoad="window.scrollTo(0,0)
    Code (markup):
    2. In the calling javascript (the button the user clicks) I have tried adding an anchor:
    
    <a href="javascript:loadSource('right',null,'mandatorypreworkshopinfo.html#top')">
    
    Code (markup):
    and added the

    <a name="top"></a>
    Code (markup):
    to the top of the html file being called. That has no effect either.

    I have spent hours on this already. Please help if you can

    Thanks.
    -Rick
     
    aricknophobia, May 9, 2007 IP
  2. bobby9101

    bobby9101 Peon

    Messages:
    3,292
    Likes Received:
    134
    Best Answers:
    0
    Trophy Points:
    0
    #2
    well I ened to see it to look at it, so please post your URL ;)
     
    bobby9101, May 10, 2007 IP
  3. asfi

    asfi Peon

    Messages:
    110
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Post your URL
     
    asfi, May 10, 2007 IP
  4. aricknophobia

    aricknophobia Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    http://www.beginningsguide.com/content/prior.htm

    the site is password protected:
    username: admin
    Password: 0220220

    It only works 100% in IE right now, sorry.

    In order to experience the problem, you can click on "prior to arrival" at top or bottom, then on the left click on "what to send us." scroll down the content on the right, and then click on a different left-link: "mandatory pre-workshop information." You will see that the newly loaded right content loads in middle or at bottom.

    The scrollbars are from CSS. I'm trying to either reset them somehow, or get the page to load at the top. A 3rd option logically might be to load a blank page BEFORE loading the new link (to somehow get it to load two pages, one right after the other) since after clicking on a page without enough text to warrant scrollbars, the next scrolled page loads at the top.

    I will love you more than you can imagine if you can help me.

    Thanks!
     
    aricknophobia, May 11, 2007 IP
  5. bobby9101

    bobby9101 Peon

    Messages:
    3,292
    Likes Received:
    134
    Best Answers:
    0
    Trophy Points:
    0
    #5
    this is actually pretty obvious.
    The content is changing without page reloads and the div doesn't know that so it keeps the scrollbar right where it was. you need to force reloads, or reset the scollbar.
     
    bobby9101, May 11, 2007 IP
  6. aricknophobia

    aricknophobia Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    awesome. might you be able to point me in the right direction to either or both of those things? I can't find out how to reset a scrollbar that's CSS controlled. I fear I may have gotten in a bit over my head with this, but that's how we get better I suppose.
     
    aricknophobia, May 11, 2007 IP