Bonjour,

Je ne comprends pas pourquoi ce script s'execute mal sous Internet Explorer et bien sous IE. Avez vous une idée ?

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
 
 
<html>
<head>
<title>Test XmlHttpRequest</title>
<script type="text/javascript">
<!--/*--><![CDATA[//><!--
 
function getHTTPObject()
{
 var x = false;
 try   {
     x = new ActiveXObject("Msxml2.XMLHTTP");
    }
 catch (e) {
     try   {
         x = new ActiveXObject("Microsoft.XMLHTTP");
        }
     catch (e) {
	try {
         x = new XMLHttpRequest();
	 }
	 catch(e)
	 {
		x=false;
	 }
        }
    }
 return x;
}
 
function affich_truc(message)
{
	var xmlhttp = getHTTPObject();
 
	if(xmlhttp==false)
	{
		document.getElementById('para').innerHTML="Votre navigateur ne supporte pas l'objet XmlHttpRequest";
		return false; //en retournant false, on court circuite cette fonction et on peut ainsi proposer une solution tout php au visiteur qui ne supporte pas XmlHttpRequest
	}
	else
	{
		document.getElementById('para').innerHTML="C good";
	}
}
 
//--><!]]>
</script>
</head>
<body>
<form id="formulaire">
<input type="text" id="texte" onKeyUp="affich_truc(this.value)" />
</form>
<div id="para"></div>
</body>
</html>
Merci de votre aide