I was lost while doing a simple php-based chatfunction. My problem focuses on entering a user's chat-page once because I've added a scrollbar in the post window, the focus is on top, while I want to keep it down (to keep up with the latest posts). Any quick solutions?
Post Code:
& lt ;? Php if (file_exists ("mld.php")) {$ file = fopen ("mld.php", "R"); Echo fed ($ file, filesize ("mld.php")); Fclose ($ file); }? & Gt; Type the code:
gt; & lt; b & gt; please write something! & Lt; / font & gt; & lt; / b & gt;" ; Die; } $ Time = gmdate ("MDYH: I: S"); $ Com = $ _POST ['txt']; $ Count = strlen ($ com); $ Com = strips lash ($ com); $ Fp = $ file = fopen ("mld.php", "a"); FILIT ($ file, $ time); Filitt ($ file, $ com); Filitt ($ file, $ count); Fclose ($ FP); Echo '& lt; Script type = "text / javascript" & gt; Window.location = ""; & Lt; / Script & gt; '; }? & Gt; js:
function dot text (elemID, text) {var elem = document.getElementById (elemID); Elem.inner HTML + = Text; } This serves as a purpose, next to the fact that the scrollbar is automatically on top at the top after loading / reloading on the page. Any help with this code would be greatly appreciated
Just use some javascript to scroll down Make it very easy.
function scrollbot () {var d = // Select the element you want to scroll here if (d.scrollHeight> gtc; d.clientHeight) {d.scrollTop = d .scrollHyight - d.clientHeight; }} Wherever you need to scroll in your code, just run this function
No comments:
Post a Comment