<script language=javascript>
function createXMLHttpRequest() {
if (window.XMLHttpRequest) {//Mozilla
xmlHttp = new XMLHttpRequest();
}
else if (window.ActiveXObject) {//IE
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
}
function readjs(){
createXMLHttpRequest();
xmlHttp.open("get","readjs.php?fresh="+Math.random(),true);
xmlHttp.onreadystatechange = function(){
if(xmlHttp.readyState==4){
document.getElementById("js").innerHTML = xmlHttp.responseText;
}
else{
}
}
xmlHttp.send(null);
window.setTimeout("readjs()",3000);
}
</script>
<body onload=readjs()>
<span id=js></span>
</body>
readjs.php
<?php echo date("H:i:s");?>