CONFUSIONUK Posted July 17, 2010 Share Posted July 17, 2010 Below I have a script I have quickly whipped up to show you the principles of what I am on about. Pretty straight forward, #shouts div includes shouts.php with shouts from shoutbox, jquery refreshes the #shouts div with the contents from shout.php every X amount of seconds... All is well and works fine but I am a bit fussy when it comes to the little details, basically you can scroll through the shouts in the div fine while it is refreshing them constantly BUT, would anyone know if it is even possibly to stop the refresh from loosing focus ie when you highlight some text in the div and it refreshes your text will still be highlighted? Any help will be much appreciated <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Refresh</title> <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script> <script type="text/javascript"> var auto_refresh = setInterval( function() { $('#shouts').load('shouts.php'); }, 1000); </script> <style type="text/css"> #shouts { background: #36F; height: 200px; overflow: auto; width: 300px; } </style> </head> <body> <div id="shouts"><?php include'shouts.php'; ?></div> </body> </html> Quote Link to comment Share on other sites More sharing options...
CONFUSIONUK Posted July 28, 2010 Author Share Posted July 28, 2010 bump... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.