Bonjour,

J'ai trouvé un script pour permettre de faire des recherches sur mon site web, le problème c'est que la recherche ne fonctionne pas avec firefox(elle fonctionne avec ie et netscape).
Comment faire pour la faire fonctionner sous firefox? voici le script en question :
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
<script language="JavaScript">
 
var NS4 = (document.layers);
var IE4 = (document.all);
var win = window;
var n = 0;
function Rechercher(str) {
var txt, i, found;
if (str == "")
return false;
if (NS4) {
if (!win.find(str))
while(win.find(str, false, true))
n++;
else
n++;
// Si le mot n'a pas été trouvé (Netscape)
if (n == 0)
alert("Aucuns résultats");
}
if (IE4) {
txt = win.document.body.createTextRange();
// Find the nth match from the top of the page.
for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
txt.moveStart("character", 1);
txt.moveEnd("textedit");
}
if (found) {
txt.moveStart("character", -1);
txt.findText(str);
txt.select();
txt.scrollIntoView();
n++;
}
else {
if (n > 0) {
n = 0;
Rechercher(str);
}
// Si le mot n'a pas été trouvé (Explorer)
else
alert("Aucuns résultats");
}
}
return false;
}
</script>
 
<form name="Recherche" onSubmit="return Rechercher(this.mot.value);">
<input name="mot" type="text" size=20 onChange="n = 0;">
<input type="submit" value="Rechercher">
</form>
Voila j'espère que vous pourrez m'aider.