• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4110
  • Last Modified:

auto scroll to bottom of page...

Hi experts.
I'm developing a simple little chat and would like the text to scroll to the bottom of the page. How would I do this???
thanks.
0
kephillips
Asked:
kephillips
1 Solution
 
archrajanCommented:
<SCRIPT>
document.body.scrollTop = document.body.scrollHeight
</script>
0
 
justinbilligCommented:

I am not exactly sure what your asking for.

If you mean something like this


<html>
      <body>
            <form name="frmMain">
                  <input type="text" name="txtChatText" value="">
                  <input type="button" value="Chat" onclick="this.form.txtChatResults.value+=this.form.txtChatText.value;">
                  
                  <br>
                  <textarea name="txtChatResults" rows="10" cols="10"></textarea>
            </form>
      </body>
</html>


I am assuming this is a chat between two users, how are you getting the information from one client to the other?
0
 
kephillipsAuthor Commented:
justinbillig,
I'm using mysql as a backend...
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
kephillipsAuthor Commented:
arch,
sorry no go..
doesn't do a thing...
0
 
kephillipsAuthor Commented:
i found what I was looking for guys,

<body onLoad="for (i=0;i<window.screen.availHeight;i++) {window.scroll(0,i); }">
thanks anyways!
0
 
archrajanCommented:
Thanks for sharing the answer!
Good luck
0
 
Michel PlungjanIT ExpertCommented:
That does not look right....

If you want the page to scroll to the bottom it is just luck chat window is smaller than the available height and it will stop at for example 600 pixel if that is the size of the window... unless you refresh the window and remove the text that is no longer visible



<body onLoad="window.scrollTo(0,9999999)">
will also work unless you chat for days
0
 
ThaSmartUnoCommented:
I used this:

    var yoffset = -3;
    function scrollToBottom() {
        while (yoffset!=window.pageYOffset) {
            yoffset=window.pageYOffset;
            window.scrollBy(0,600);
        }
    }

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now