[AJAX] Rafraichissement d'un fichier texte inclu dans une page
Bonjour,
j'ai ma page index, à l'intérieur de celle-ci un fichier texte est inclu,
j'aimerais que le fichier inclu sois rafraichi tout les x seconde.
J'ai essayé quelque chose mais ca ne fonctionne pas
Voici ma page index
Code:
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 57 58 59 60 61 62 63 64 65 66 67 68
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="robots" content="noindex, nofollow">
<meta http-equiv="pragma" content="no-cache">
<script src="XHRConnection.js" type="text/javascript"></script>
<script type="text/javascript">
/** Utilitaire pour manipuler XHRConnection
@param cible string identificateur de la balise
@param url string l'adresse du contenu à charger
*/
function loadHtm(cible,url)
{
var XHR = new XHRConnection();
XHR.setRefreshArea(cible);
XHR.sendAndLoad(url, "POST");
return true;
}
/** fonction périodique pour rafraichir une cible
@param delay int Le delai en secondes
@param cible string l'identificateur d'un noeud dom
@param url string l'adresse du contenu à rafraichir
*/
function refresh(delay,cible,url)
{
loadHtm(cible,url);
timer = setTimeout('refresh()',1000*delay);
}
</script>
</style>
</head>
<body onload="document.getElementById('frame').scrollTop=document.getElementById('frame').scrollHeight;refresh(2,'frame','log')">
</div>
<div class="frame" id="frame">
<?php //include ('log.txt'); ?>
</div>
</body>
</html> |
et quelque ligne du fichier log.txt
Code:
1 2 3 4 5 6 7 8 9 10 11
|
<br /><b>02/01/2007 à 14.54:56</b> - <b style="color:red;">195.162.194.35</b> - <b>Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1</b>
<br /><b>02/01/2007 à 14.55:02</b> - <b style="color:red;">195.162.194.35</b> - <b>Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1</b>
<br /><b>02/01/2007 à 14.56:12</b> - <b style="color:red;">195.162.194.35</b> - <b>Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1</b>
<br /><b>02/01/2007 à 15.35:41</b> - <b style="color:red;">195.162.194.35</b> - <b>Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1</b>
<br /><b>02/01/2007 à 15.48:43</b> - <b style="color:red;">195.162.194.35</b> - <b>Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1</b>
<br /><b>02/01/2007 à 15.49:34</b> - <b style="color:red;">195.162.194.35</b> - <b>Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1</b>
<br /><b>02/01/2007 à 15.49:39</b> - <b style="color:red;">195.162.194.35</b> - <b>Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1</b>
<br /><b>02/01/2007 à 15.49:44</b> - <b style="color:red;">195.162.194.35</b> - <b>Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1</b>
<br /><b>02/01/2007 à 15.49:47</b> - <b style="color:red;">195.162.194.35</b> - <b>Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1</b>
<br /><b>02/01/2007 à 15.50:33</b> - <b style="color:red;">195.162.194.35</b> - <b>Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1</b> |