Bonjour à toutes et à tous,

J'ai un problème sur l'ajout d'un evenement (" onclick='detail_devis(me.value)'>" ligne 141) via la commande document.write sur une table générée dynamiquement.
Quand je clique sur la cellule contenant un n° de devis il me dit ne pas connaître me, this, etc.
Avez-vous une idée?
Par avance merci.
ci-dessous le code ainsi qu'un extrait du fichier ecr.txt
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
[140220131003,14/02/2013,DUPONT,123,50,10,90,2
140220131003,14/02/2013,DUPONT,456,25,20,60,3
]


Code asp : 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<body>
<FORM>
<center>
<h1>Gestion des devis</h1>
</center>
<input id="Enreg" type="button" value="Enregistrer un devis"
style="background-color:#330099" style="color:white; font-
weight:bold" onclick="document.location='enreg.html'">
 
<input id="Recherche" type="button" value="Rechercher référence pièce, nom client, date, etc."
style="background-color:#8A2BE2" style="color:white; font-
weight:bold" onclick="recherche();">
 
<input id="lister" type="button" value="Lister tous les devis" 
style="background-color:#6495ED" style="color:white; font-
weight:bold" onclick="lister2()">
 
</form
</body>
<script type="text/vbscript">
const cteRapport = "c:\temp\ecr.txt"
Sub recherche()
dim tableau
dim mot_cherche
dim compteur
compteur = 0
 mot_cherche = inputbox("Quel est la chaîne de caractères recherchée ?")
 mot_cherche=ucase(mot_cherche)
If mot_cherche = "" Then
        msgbox "Annuler"
		exit sub
End If 
fichier_lecture_1 = "c:\temp\ecr.txt"
Set fso = CreateObject("Scripting.FileSystemObject") 
set fichier_lecture_2 = fso.opentextfile(fichier_lecture_1, 1, true)
en_tete()
do until fichier_lecture_2.atendofstream 
	chaine = fichier_lecture_2.readline()
		if instr(1, chaine, mot_cherche) > 0 then
			tableau=split(chaine,",")
			document.write("<tr>")
			document.write("<td>")
			document.write tableau(0)
			document.write("</td>")
			document.write("<td>")
			document.write("<FONT COLOR='#800080' SIZE=3>")
			document.write tableau(1)		
			document.write("</td>")		
			document.write("<td>")
			document.write("<FONT COLOR='blue' SIZE=3>")
			document.write tableau(2)
			document.write("</td>")
			document.write("<td>")
			document.write("<FONT COLOR='green' SIZE=3>")
			document.write tableau(3)		
			document.write("</td>")		
			document.write("<td>")
			document.write("<FONT COLOR='maroon' SIZE=3>")
			document.write tableau(4)		
			document.write("</td>")
			document.write("<td>")
			document.write("<FONT COLOR='steelblue' SIZE=3>")
			document.write tableau(5)		
			document.write("</td>")
			document.write("<td>")
			document.write("<FONT COLOR='green' SIZE=3>")
			document.write tableau(6)		
			document.write("</td>")
			document.write("<td>")
			document.write("<FONT COLOR='orange' SIZE=3>")
			document.write tableau(7)		
			document.write("</td>")
			document.write("</tr>")	
		end if
loop
document.write("</table>")
fichier_lecture_2.close 
set fichier_lecture_2 = nothing
set fso = nothing 
End Sub
sub en_tete()
document.write("<table border=1 cellspacing=1 cellpadding=5>")
document.write("<tr bgcolor='cyan'>")
Document.Write("<td>")
Document.Write("<font STYLE='text-decoration:underline' size=3>N° du devis</font>")
document.write("</td>")
Document.Write("<td>")
Document.Write("<font color='#DC143C' STYLE='text-decoration:underline' size=3>Date de la commande</font>")
document.write("</td>")
document.write("<td>")
document.write("<FONT COLOR='#800080' STYLE='text-decoration:underline' SIZE=3>Nom du client</font>")
document.write("</td>")
document.write("<td>")
'document.write("<FONT COLOR='blue' FACE='Arial, Helvetica, sans-serif' SIZE=3>Référence de la pièce</font></td>")
document.write("<FONT COLOR='blue' STYLE='text-decoration:underline' SIZE=3>Référence de la pièce</font></td>")
document.write("</td>")
document.write("<td>")
document.write("<FONT COLOR='green' STYLE='text-decoration:underline' SIZE=3>Prix catalogue</font></td>")
document.write("</td>")
document.write("<td>")
document.write("<FONT COLOR='maroon' STYLE='text-decoration:underline' SIZE=3>Remise</font></td>")
document.write("</td>")
document.write("<td>")
document.write("<FONT COLOR='steelblue' STYLE='text-decoration:underline' SIZE=3>Prix après remise</font></td>")
document.write("</td>")
document.write("<td>")
document.write("<FONT COLOR='steelblue' STYLE='text-decoration:underline' SIZE=3>Quantité</font></td>")
document.write("</td>")
document.write("</tr>")
end sub
sub message()
document.write("bonjour")
end sub
Sub lister2()
  Const ctePourLecture = 1 
  ' Nom du fichier à lire 
  Dim objFSO, objFichier, Texte, Message 
  Dim Chaine, Position 
 ' Création d'on objet pour l'accès au système de fichier 
  Set objFSO = CreateObject("Scripting.FileSystemObject")
 ' Si fichier existe 
  If ( objFSO.FileExists(cteRapport) ) Then 
  ' Création d'un objet fichier pour accès au fichier, et ouverture 
    Set objFichier = objFSO.OpenTextFile(cteRapport, ctePourLecture) 
  ' Tant que fichier n'est pas terminé
en_tete()
    While Not objFichier.AtEndOfStream 
		texte = objFichier.ReadLine
		' Recherche la position de caractère [,] 
        ' InStr(1, Texte, ",", 1) 
        ' 1 = À partir du premier caractère 
        ' Texte , texte dans lequel la recherche s'effectue 
        ' "," = Caractère recherché 
        ' 1 = Méthode de comparaison en texte  
        Position = InStr(1, Texte, ",", 1) 
        ' Capture le texte 1 caractère plus loin 
        ' donc après le [="] 
        'Texte = Mid(Texte,(Position + 1))		
		document.write("<tr>")
		document.write("<td")
		document.write(" onclick='detail_devis(me.value)'>")		
document.write (mid(texte,1,(position-1)))
		'document.write(" onclick=document.location='coucou.html'>") //fonctionne
		'document.write(" onclick=document.location='coucou.html" + texte + ";'>") //fonctionne
		'document.write("<option onclick='changerCouleur(\""+mesCouleurs[i]+"\");' style='background-color:"+ mesCouleurs[i] +";'>"+ 'mesCouleurs[i] +"</option>"); 
		'document.write("************")
		document.write("</td>")
		document.write("<td>")
		Texte = Mid(Texte,(Position + 1))
		Position = InStr(1, Texte, ",", 1)
		document.write("<FONT color='#DC143C' SIZE=3>")
		document.write (mid(texte,1,(position-1)))		
		document.write("</td>")	
		document.write("<td>")
		Texte = Mid(Texte,(Position + 1))
		Position = InStr(1, Texte, ",", 1)
		document.write("<FONT COLOR='#800080' SIZE=3>")
		document.write (mid(texte,1,(position-1)))		
		document.write("</td>")		
		document.write("<td>")
		Texte = Mid(Texte,(Position + 1))
		Position = InStr(1, Texte, ",", 1)
		document.write("<FONT COLOR='blue' SIZE=3>")
		document.write (mid(texte,1,(position-1)))
		document.write("</td>")
		document.write("<td>")
		Texte = Mid(Texte,(Position + 1))
		Position = InStr(1, Texte, ",", 1)
		document.write("<FONT COLOR='green' SIZE=3>")
		document.write (mid(texte,1,(position-1)))		
		document.write("</td>")		
		document.write("<td>")
		Texte = Mid(Texte,(Position + 1))
		Position = InStr(1, Texte, ",", 1)
		document.write("<FONT COLOR='maroon' SIZE=3>")
		document.write (mid(texte,1,(position-1)))		
		document.write("</td>")		
		document.write("<td>")
		Texte = Mid(Texte,(Position + 1))
		Position = InStr(1, Texte, ",", 1)
		document.write("<FONT COLOR='red' SIZE=3>")
		document.write (mid(texte,1,(position-1)))		
		document.write("</td>")		
		document.write("<td>")
		Texte = Mid(Texte,(Position + 1))
		'Position = InStr(1, Texte, ",", 1)
		document.write("<FONT COLOR='steelblue' SIZE=3>")
		document.write texte		
		document.write("</td>")		
		'document.write("</tr>")		
		'document.write texte
		'document.write("<br>")
        ' Enlève les 2 derniers caractères, 
        ' le caractère de saut de ligne et les guillemets 
        'Texte = Mid(Texte, 1, (Len(Texte) - 2)) 
        ' Ajoute le texte trouvé avec un saut de ligne [vbCrLf] 
        'Message = Message & vbCrLf & Texte
    Wend 
'Document.Write(" </tr>")
Document.Write("</table>")
     ' Ferme le fichier 
    objFichier.Close
     ' Libère l'objet Fichier 
    Set objFichier = Nothing
     ' Affiche à l'écran
    'msgbox Message
  Else
     ' Affiche à l'écran 
    msgbox "Fichier absent"
  End If
   ' Libère l'objet du système de fichier 
  Set objFSO = Nothing
' Quitte le script avec [0] comme paramètre 
' pour signaler "Aucune erreur" 
'WScript.Quit(0)
End Sub
sub detail_devis(num)
alert (num)
end sub
</script>