Salut,

J'utilise httprequest pour changer la valeur d'un textfield. Le code marche sur FF, mais pas sur IE6.
J'ai la bonne valeur dans xmlHttp.responseText;
Il plante sur :
document.getElementById("category").value=xmlHttp.responseText;

Le code marche sur IE et FF sur un serveur Fedora core 2, avec php 5.2.0 et mysql 4.
Mais pas sur CentOS 5.2, php 5.2.6, et mysql 5



Ajax :
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
 
<script type="text/javascript">
var xmlHttp;
 
function showHint(str)
{
  var str1=null;
  if (str.length==0)
    {
      document.getElementById("category").innerHTML="";
      return;
    }
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)
    {
      alert ("Browser does not support HTTP Request");
      return;
    }
  var url="get_category.php";
  url=url+"?q="+str;
  url=url+"&sid="+Math.random();
  var b;
  xmlHttp.open("GET",url,true);
  xmlHttp.onreadystatechange=stateChanged;
  xmlHttp.send(null);
 
  return(str);
}
 
function stateChanged()
{
  var str=null;
  if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
      var x;
      x = document.getElementById("category").value;
      x = xmlHttp.responseText;
      document.getElementById("category").value=xmlHttp.responseText;
 
    }}
function createXMLHttpRequest(){
  var xmlHttp = null;
  if(typeof XMLHttpRequest != "undefined"){
    xmlHttp = new XMLHttpRequest();
  }
  else if(typeof window.ActiveXObject != "undefined"){
    try {
      xmlHttp = new ActiveXObject("Msxml2.XMLHTTP.4.0");
    }
    catch(e){
      try {
        xmlHttp = new ActiveXObject("MSXML2.XMLHTTP");
      }
      catch(e){
        try {
          xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch(e){
          xmlHttp = null;
        }
      }
    }
  }
  return xmlHttp;
}
Textfield a remplir :
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
 
                               <tr><td class="error" colspan="2" ><?php  printError('category', $errors);?></td></tr>
                        <tr>
                                <td class="labelCell3">Category Entered *</td>
                                <td class="fieldCell3">
                                <select name="list_category_parent" onChange="javascript : modiflist()" >
                                        <option value=""></option>
                                <?php
                                $sql = "SELECT * FROM tbl_parent_category";
                                $res_sql = mysql_query($sql, $prideinprint) or die (mysql_error());
                                if (mysql_num_rows($res_sql) != 0)
                                {
                                        while ($row = mysql_fetch_array($res_sql))
                                        {
                                                $id_parent = $row[0];
                                                $name_parent = $row["parent_category_name"];
                                 print "<option value=" . $id_parent;
                                 if ($id_parent == $cat) {
                                   print " selected";
                                 }
                                 print ">" . $name_parent ."</option>";
                                }
                         }
                                ?>
                                 </select>
                </td>
                  </tr>
 
 
                        <tr>
                                <td class="labelCell3">Category Entered *</td>
                                <td class="fieldCell3"><input name="category" type="text" id="category" size="46" maxlength="64" value="" readonly="true"/><\
/td>
                        </tr>