Jump to content

auto refresh div FLICKER


Craig Hopson

Recommended Posts

hi guys using this but it flickers wen reloading how can i stop it

<script type="text/JavaScript">// Customise those settingsvar seconds = 5;var divid = "timediv";var url = "feedx.php";//////////////////////////////////// Refreshing the DIV//////////////////////////////////function refreshdiv(){// The XMLHttpRequest objectvar xmlHttp;try{xmlHttp=new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari}catch (e){try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer}catch (e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch (e){alert("Your browser does not support AJAX.");return false;}}}// Timestamp for preventing IE caching the GET requestfetch_unix_timestamp = function(){return parseInt(new Date().getTime().toString().substring(0, 10))}var timestamp = fetch_unix_timestamp();var nocacheurl = url+"?t="+timestamp;// The code...xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){document.getElementById(divid).innerHTML=xmlHttp.responseText;setTimeout('refreshdiv()',seconds*1000);}}xmlHttp.open("GET",nocacheurl,true);xmlHttp.send(null);}// Start the refreshing processvar seconds;window.onload = function startrefresh(){setTimeout('refreshdiv()',seconds*1000);}    </script>

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...