<html><body><script type="text/javascript">
function Ajax(){
var 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("No AJAX!?");
return false;
}
}
}
xmlHttp.onreadystatechange=function(){
document.getElementById('ReloadThis').innerHTML=xmlHttp.responseText;
setTimeout('Ajax()',2000);
}
xmlHttp.open("GET","index1.php",true);
xmlHttp.send(null);
}
window.onload=function(){
setTimeout('Ajax()',2000);
}
</script><div id = "elsewhat">shouldn't flicker</div><div id="ReloadThis">Current server uptime: <?php $data = shell_exec('uptime');
$uptime = explode(' up ', $data);
$uptime = $uptime[0]; echo ('Current server uptime: '.$uptime.'');?>)</div></body></html>
this gives me a copy of the "should flicker" text and the uptime, instead of just the up time. what am I doing wrong? when testing with a more complicated webpage, it sticks the whole webpage in the <div>?
im using the the code from 007Julien and it works perfect for me. Im using the code on a livescore page, and i therefor wonder if its possible to make new entry fade in/blink/make a sound? I plan to us it when the new entry is a new goal.
Anyone who can help??
Originally Posted by noufal
The code shown below doesn't work in IE7.please someone help me to find the answer.is there any mistakes in the code????????
Hi all. I ve tried the first code that Tabo uploaded, it works fine on Firefox, Chrome, Safari but I cant get it working on Internet Explorer...I ve been looking everywhere and I dont understand where is the problem. here is my full coding :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
Here , above the file “reload.php” will be reloaded in every 20000ms ie 20 second . You can change the file which you have to reload and you can also change the reload time as per your requirement.
and secondly , the #loaddiv is the name of DIV which is going to be refreshed.
Step 2:
and now you need to put the div in the body section of your page
Here , above the file “reload.php” will be reloaded in every 20000ms ie 20 second . You can change the file which you have to reload and you can also change the reload time as per your requirement.
and secondly , the #loaddiv is the name of DIV which is going to be refreshed.
Step 2:
and now you need to put the div in the body section of your page
<div id="loaddiv"></div>
Good code, Pankash1989, thanks.
Another option is to disable cache (if you need to load fresh data, like XML feed):
This code refreshes correctly, but reload.php shows after 20 sec. I want when webpage is loaded my reload.php file is shown and after each 20 sec it be reloaded.
Bookmarks