Bonjour,

Mon script ne me retourne pas de valeur sur IE alors que sur firefox, il faonctionne très bien.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
function goCodePostalVille(param1,param2)
{
   var xmlhttp = null;
 
   try{
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
   }
   catch(e){
      try{
         xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch(e){
         xmlhttp = false;
      }
   }
 
   if (!xmlhttp && typeof XMLHttpRequest!='undefined'){
      xmlhttp = new XMLHttpRequest();
   }
 
   xmlhttp.open('GET', '../ajax/ajaxCodePostalVille.php?param1='+param1.value,false);
   xmlhttp.setRequestHeader('User-Agent', 'Test generate select');
   xmlhttp.setRequestHeader('Accept', 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.7,*/*;q=0.1');
   xmlhttp.send(null);
 
   if(xmlhttp.status == 200)
   {
      var liste1 = xmlhttp.responseXML.getElementsByTagName('balise1');
      var liste2 = xmlhttp.responseXML.getElementsByTagName('balise2');
 
      var liste_select = document.getElementById(param2);
      var tmp = document.createElement('option');
 
      while(document.getElementById(param2).options.length > 0){
         document.getElementById(param2).removeChild(document.getElementById(param2).options[0]);
      }
 
      for(var i = 0, m = liste1.length; i < m; i++)
      {
         tmp.setAttribute('value', liste2[i].firstChild.nodeValue);
         tmp.removeAttribute('selected');
         if (liste2[i].firstChild.nodeValue == param2) tmp.setAttribute('selected', 'selected');
         tmp.appendChild(document.createTextNode(liste1[i].firstChild.nodeValue));
         liste_select.appendChild(tmp);
         tmp = tmp.cloneNode(false);
      }
 
      liste_select.disabled = false;
   }
}
Je test pourtant IE.