1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> Test Compteur </TITLE>
<BODY>
<script type="text/javascript" src="ajax2.js">
function createXHR()
{
var request = null;
try {
request = new ActiveXObject('Msxml2.XMLHTTP');
}
catch (err2) {
try {
request = new ActiveXObject('Microsoft.XMLHTTP');
}
catch (err3) {
try {
request = new XMLHttpRequest();
}
catch (err1)
{
return request;
}
}
}
return request;
}
function compter()
{
var xhr=createXHR();
xhr.open("GET", "stats/compteur_v.txt",true);
xhr.onreadystatechange = function()
{
if (xhr.readyState == 4 && xhr.status == 200)
{
document.getElementById('compteur').innerHTML=xhr.responseText;
}
}
xhr.send(null);
}
setInterval('compter()',10000);
</script>
<?php
echo "Visiteurs : ";
?>
<CENTER>
<p id="compteur"></p>
</BODY>
</HTML> |