For my personal site I want to insert a simple ajax server clock into my website, but for some reason it's not showing up in the header. Here's the Javascript code
var httpxml;
try {
// Firefox, Opera 8.0+, Safari
httpxml=new XMLHttpRequest();
} catch (e) {
// Internet Explorer
try {
httpxml=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
httpxml=new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
alert("ur browser doesn't support ajax m8, try reinstalling windows 95");
return false;
}
}
}
function stateck() {
if(httpxml.readyState==4) {
document.getElementById("time").innerHTML=httpxml.responseText;
}
}
var url="ajax-server-clock-demock.php";
url=url+"?sid="+Math.random();
httpxml.onreadystatechange=stateck;
httpxml.open("GET",url,true);
httpxml.send(null);
tt=timer_function();
}
function timer_function(){
var refresh=1000; // Refresh rate in milli seconds
mytime=setTimeout('AjaxFunction();',refresh)
}
And in php file
<?Php
echo date("d/m/y : H:i:s", time());
?>
Lastly in the header
<time>bacon</time>