SoireeExtreme Posted April 22, 2007 Share Posted April 22, 2007 Hi, I have need to know how when a person posts a message to a chat room window how to get the chat room window (iframe) to scroll when that message is posted instead of the person having to scroll the window themselves to see the newly posted messages. Any ideas? Or if you could, link me to a tutorial on how to do this or what might help me with my problems. If you have any questions please ask. Thank you in advance. Link to comment https://forums.phpfreaks.com/topic/48152-chat-scrolling-help/ Share on other sites More sharing options...
Navarr Posted April 22, 2007 Share Posted April 22, 2007 This is more of a JavaScript problem then a PHP problem. Google around for scripts for shoutboxes that make them scroll down. I don't think this can truly be done with PHP, because its something that needs to happen client side instead of server side. Link to comment https://forums.phpfreaks.com/topic/48152-chat-scrolling-help/#findComment-235384 Share on other sites More sharing options...
Glyde Posted April 22, 2007 Share Posted April 22, 2007 My personal suggestion...have the newer messages appear at the top...after all, isn't that the first part someone looks at anyways? Then you don't need javascript to scroll down for you. Link to comment https://forums.phpfreaks.com/topic/48152-chat-scrolling-help/#findComment-235387 Share on other sites More sharing options...
SoireeExtreme Posted April 22, 2007 Author Share Posted April 22, 2007 Actually I was wondering about making it appear at the top. But am not sure how to do that either. I am still very new to php. Or coding for that matter. But having it appear at the top would be nice. Could you point me in the right direction for that? Would I find out how to do that in javascript as well? Or would php be a good start to look? Link to comment https://forums.phpfreaks.com/topic/48152-chat-scrolling-help/#findComment-235389 Share on other sites More sharing options...
Navarr Posted April 22, 2007 Share Posted April 22, 2007 To display the newer messages at the top; just echo the older messages first. It depends on how your script was written. If its in MySQL and has timestamps, its easy. SELECT * FROM `table` ORDER BY `timestamp` DESC Link to comment https://forums.phpfreaks.com/topic/48152-chat-scrolling-help/#findComment-235390 Share on other sites More sharing options...
SoireeExtreme Posted April 22, 2007 Author Share Posted April 22, 2007 Actually it does work with the time in ASC order. But when I change it to DESC order it will show up the number of messages it is suppose. But when I send a new messages to the room it doesn't do anything except sit there. But it will so that message I just tried to post when I change it back to ASC and refresh the whole page... Ugh... Any ideas for me? Sorry if I seem like such a pain... Link to comment https://forums.phpfreaks.com/topic/48152-chat-scrolling-help/#findComment-235396 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.