Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Go to the last position in a Page.

Status
Not open for further replies.

JuanjoZun

Programmer
Jul 20, 2002
82
MX
Hello
I'm refreshing every 10 seconds... Pulling data from a Database... but Everytime I refresh, the page shows the FIRST ROW of the PAGE... I want to show the LAST ROW...

You know, like a chat.


Thanks... for all ur time... I've learned a lot here.

Juanjo


Follow the dark side, so you can reach the light.
 
I'd reverse the order of the data pulled from the DB so that the last item chronologically is the first on up top.

in SQL this can be done like so :

ORDER BY time DESC (or ASC)

Gary Haran
==========================
 
I did it already, but really I want to do the first question... like an anchor... but without a click on the link...

IF someone has an idea...

Juanjo



Follow the dark side, so you can reach the light.
 
Can't you use an anchor that would be dynamically inserted into the last row?

Don't know how you're refreshing but when doing doing so you could do this:

window.location = "
(don't know if I've got the syntax exactly right, but hopefully I'm communicating the basic idea).

My guess would be that if the anchor does not exist, the page would just load to the top as usual.

Hope that helps.
 
How about this:
<body onload=&quot;scrollTo(0,document.body.scrollHeight)&quot;>
 
Good Adam0101!!

Thank you very much, It works very good... two times you have solved my problems!

Thanks [peace]

Juanjo




Follow the dark side, so you can reach the light.
 
[thumbsup]
two first options are good and woks too... but I was looking for something like the last post...

Thanks, Experts

Juanjo

Follow the dark side, so you can reach the light.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top