SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Bottom of Iframe.

    Ok I have an iframe and I am adding content to this frame by doing document.write(). Ok After the page gets too big I want it to scroll to the bottom of the page. Is there anyway to make it scroll to the bottom of the iframe every time I add text using document.write()?

    Thanks in advance!

  2. #2
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    document.body.scrollTop=n+"px" where n>total iframe body height.
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  3. #3
    SitePoint Enthusiast DaveCheney's Avatar
    Join Date
    Dec 2003
    Location
    Melbourne, Australia
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I stole this from a chat script that I wrote using two iframes. In the BODY tag I use this method

    window.scrollTo( 0, 84728472 )

    I'm not sure where I got the 84728472 from, but it was probably just a large enough number to always be beyond the size of my iframe. On IE this causes the frame to scroll to the bottom. This has to be called from inside the iFrame.

    Cheers

    Dave

  4. #4
    SitePoint Enthusiast
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I already tried that. And it doesn't work... Any other ideas? I tried:

    OnLoad="window.scrollTo( 0, 84728472 )"

  5. #5
    SitePoint Enthusiast
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Markdidj
    document.body.scrollTop=n+"px" where n>total iframe body height.
    There is really no way for me to figure out the amount of pixels from the top of the script.

  6. #6
    SitePoint Enthusiast
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I figured it out...

    I just called a function on the iframes' window to make it goto the bottom using ScrollTo.

    Thanks for the help!

  7. #7
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by WhSox21
    There is really no way for me to figure out the amount of pixels from the top of the script.
    84728472 can be used here as well
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if


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
  •