SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: window.scroll

Hybrid View

  1. #1
    SitePoint Enthusiast teknikewl's Avatar
    Join Date
    Feb 2002
    Location
    Pennsylvania, USA
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    window.scroll

    I have the following script portion that when the page reloads it is to jump to the very bottom of the window. This is for a Chat script. It works great in NS 4.7 and up, but IE does not seem to like it. I only goes to the bottom of the first "page"

    Code:
    function toBottom(){
    if(document.all){
    window.scroll(0, document.body.clientHeight);
    }else{
    window.scroll(0,20000)
    }
    }

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try window.scrollTo(x,y) instead
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  3. #3
    SitePoint Enthusiast teknikewl's Avatar
    Join Date
    Feb 2002
    Location
    Pennsylvania, USA
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by beetle
    Try window.scrollTo(x,y) instead

    What would my value for 'y' be if I want it to go to the very bottom of the document? It's being used for a Chat and it would be different with every reload.

  4. #4
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As you can see here, you'd probably want to use document.body.scrollHeight
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  5. #5
    SitePoint Enthusiast teknikewl's Avatar
    Join Date
    Feb 2002
    Location
    Pennsylvania, USA
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by beetle
    As you can see here, you'd probably want to use document.body.scrollHeight
    Thanks Bettle! I shall give it a try tonight.

  6. #6
    SitePoint Enthusiast teknikewl's Avatar
    Join Date
    Feb 2002
    Location
    Pennsylvania, USA
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by teknikewl
    Thanks Bettle! I shall give it a try tonight.
    Worked like a charm! Thanks again!


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
  •