automatically scrolling down the page to the bottom after adding data to it by xmlhttpreq object?

Z

zhifchen

Hi guys,
I have some problem about my little http/javascript/xmlhttpreq based
chatroom program:
I use xmlhttpreq object to add data to the current html file.
It will add to a specifiy place, like after a tag or before a tag
And if it adds too many data after that tag, the whole page will become
big and need to scroll down to see the latest added data
how to let it scroll down automatically without any annoying scrolling
down?

One way I can use is to use a anchor which is at the bottom of that
page and after i put my data into the textbox and click the link( which
is linked to proper file to process the data but also point to the
anchor) the page will show from the bottom. but the whole page will
first jump up a little space then jump down. It's annoying too :(

Any1 has idea?

Deryk
 
R

RobG

Hi guys,
I have some problem about my little http/javascript/xmlhttpreq based
chatroom program:
I use xmlhttpreq object to add data to the current html file.
It will add to a specifiy place, like after a tag or before a tag
And if it adds too many data after that tag, the whole page will become
big and need to scroll down to see the latest added data
how to let it scroll down automatically without any annoying scrolling
down?

One way I can use is to use a anchor which is at the bottom of that
page and after i put my data into the textbox and click the link( which
is linked to proper file to process the data but also point to the
anchor) the page will show from the bottom. but the whole page will
first jump up a little space then jump down. It's annoying too :(

Any1 has idea?

Without seeing your code, only guesses are possible.

You might try window.scrollBy() with suitable values - either calculated
or just some silly number for the y value like (0, 10000):

<URL:http://www.mozilla.org/docs/dom/domref/dom_window_ref106.html>

<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/scrollby.asp>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top