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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I set iframe to automatically scroll to bottom? 1

Status
Not open for further replies.

casabella

Programmer
Aug 30, 2007
59
US
I am working on a chat room. I am using an iframe to display messages. So far, it all looks good. The problem I am having is that at the current time, text is shown top to bottom where the last message shows on top and older messages scroll down.

I would like to reverse the scrolling or at least have the frame set so that it shows the bottom most content.

Aside from jumping to bottom of frame, I hope to find a solution that does not make the frame flash too much or make it too distracting.

Can this be done?

Regards,

Jose
 
feherke,

This is nice but where would I put it?

Thanks,


Jose
 
Hi

Oops, I forgot that part. Into the parent document which contains the [tt]iframe[/tt]. Of course, it requires the chat's [tt]iframe[/tt] to be the first [tt]iframe[/tt] on the page. But that requirement is easy to change. That code is just to give an idea. For better approach we will have to know more about that chat.

Feherke.
 
Hi

Oops. That is jpadie's script plus an [tt]iframe[/tt]. [banghead]

Then you could add the code to scroll to the displayUpdatedChats() function. Personally would add a checkbox to enable/disable the auto-scrolling feature.

Feherke.
 
Yes it is!

Good idea about the check box.

Regards,


Jose
 
Hi

In thread434-1406514 you talked about changing the [tt]iframe[/tt] to [tt]div[/tt]. Please note that [tt]scrollTo()[/tt] and [tt]scrollBy()[/tt] are methods of the [tt]Window[/tt] object.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top