| 12
 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
 
 | function ajax()
{
    var xhr=null;
 
    if (window.XMLHttpRequest) { 
        xhr = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) 
    {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    //on définit l'appel de la fonction au retour serveur
 
    xhr.onreadystatechange = function() ;
 
    //on appelle le fichier reponse.xml
    xhr.open("GET", "file:///var/www/html/reponse.xml", true);
    xhr.send(null);
}
 
window.onload=function()
{
  var docXML= xhr.responseXML;
  var it = docXML.getElementsByTagName("donnee")
  var nom=unescape(self.location.pathname).split('/');
  var pag=nom[nom.length-1];
  var sui=0;
//on fait juste une boucle sur chaque element "donnee" trouvé
	for (i=0;i<it.length;i++)
 
		{ 
                   if ( it[i].firstChild.data==pag )
                     {
                        sui=i+1;
                        if ( sui >= it.length )
                          { sui=0; }
                              break;
                     }
                 }
setTimeout ( function(){ 
location.replace( it[sui].firstChild.data ); },3000 ); } | 
Partager