Bonjour j'ai crée un scripte qui mêle ASP et Ajax afin de faire une autocompletion cependant j'ai voulu étendre le système a plusieurs input et div mais rien ne fonctionne voici le code :

Code html : 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<link rel="stylesheet" type="text/css" href="document.css">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript">
<!-- #include file="gethint.asp"-->
function searchfield_focus(obj)
{
obj.style.color=""
obj.style.fontStyle=""
if (obj.value=="Search w3schools.com")
        {
        obj.value=""
        }
}
 
var pageTracker = _gat._getTracker("UA-3855518-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
<!--[if gt IE 7]>
<style>
body
{
overflow-y:scroll;
}
</style>
<![endif]-->
 
 
<script type="text/javascript">
 
 
function showHintt(str, i)
{
var xmlhttp;
if (str.length==0)
  { 
  document.getElementById("txtHint"+i).innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  for (i=1; i<=5; i++){
                if(document.getElementById("txt1"+i).value != ""){
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint2").innerHTML=xmlhttp.responseText;
    }
        }}
  }
xmlhttp.open("GET","gethint.asp?q="+str+"&cpt="+i,true);
xmlhttp.send();
}
 
function test(str)
{ 
                        document.getElementById("txtHint"+i).value = str.value;
                        if(document.getElementById("txt1"+i).value == str) {
                                document.getElementById("txtHint"+i).style.display="none";
                                }
 
                                        if (document.getElementById("txtHint"+i).style.display="none"){
                                                document.getElementById("txtHint"+i).value = "";
                                                document.getElementById('txtHint'+i).innerHTML = "";
                                                document.getElementById("txtHint"+.style.display="block";
                                        }
        }
}
 
 
/*function showHint(str, i)
{
        alert("voici le i : " + i);
        alert("voici le str : " + str);
        document.getElementById("tt"+i).value = "test";
}*/
 
</script>
<body>
<table class="example" cellspacing="0" cellpadding="0" border="0" width="100%">
<tr><td>
 
 
<form id="commande" name="commande" method="post" enctype="application/x-www-form-urlencoded" action="" >
 
 
<%
for i=1 to 5
%>
 
<h2 class="example">Exemple</h2>
<table cellspacing="0" cellpadding="3" border="0" width="100%" style="border:1px solid #d4d4d4;background:white">
<tr><td>
<p><b>Ecrire un prenom num <%=i%> :</b></p>
 
 
Prenom<%=i%> : <input type="text" id="txt1<%=i%>" name="txt1<%=i%>" onkeyup="showHint(this.value,<%=i%>);" />
 
 
 
 
 
<% response.write("<div id=""txtHint"""&i&""" name=""txtHint"""&i&"""> </div>") 
        
%>
 
<%
next
%>
 
</form>
</td></tr></table>
</body>
</html>

Apparemment les div ne supporte pas me id=""txtHint"""&i&""", du coup impossible de les appeler si quelqu'un a une solution je suis preneur !

Merçi d'avance