Salut

Je me suis inscrit sur se forum pour faire appelle a vos lumières.

Je suis en train de codé un moteur de recherche web spécialement pour les

enfants (le but c'est de filtrer les requêtes afin d'éviter les sites de m..... ).

J'ai réussi pour la première partie mais le problème c'est que je n'arrive pas à

implémenter L'url vers google avec l'info Search=SearchItem de la balise <form>.

ex: je recherche un singe je devrais

obtenir sa:http://www.google.fr/cse?cx=partner-...&sa=Rechercher

et j' obtient sa :http://www.google.fr (normale il n'est pas implémenter )

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
66
67
68
69
70
71
<HTML>
<HEAD>
<TITLE>JScript - TOONSEARCH </TITLE>
<SCRIPT LANGUAGE="JavaScript">
 
var base=new InitBase();
base.Add("not_found.html","INJURE,    INJURE,    INJURE    ,INJURE    ");
 
function disp(txt) { document.write(txt) }
function InitBase() {
	this.nb_item=0;
	this.Add=AddItem;
	this.Search=SearchItem;
}
function AddItem(page,cle) {
	var nb = this.nb_item;
	var item = new Object;
		item.page=page;
		item.cle=cle;
	this[nb]=item;
	this.nb_item++;
}
 
function SearchItem(txt) {
 
	var n=base.nb_item;
	var indice=-1;
	if (txt=="") {alert("Entrez un mot pour la recherche"); }
	else
	{	for (var i=0; i<n; i++) 
			{if (base[i].cle.toUpperCase().indexOf(txt.toUpperCase(),0)!="-1") {indice=i;}
		}
		if (indice>=0) {window.location=base[indice].page;}  
		else {window.location="http://www.google.fr/"; }
	}
}
 
</SCRIPT>
 
 
<br><br><br><br><br><br><br>
<body background>
 
  <img style="position:absolute;left:0px;top:0px;width:100%;height:100%;"
   src="file:///C:\Documents and Settings\Administrateur\Mes documents\Mes images\DISNEY.PNG" alt=""/>
  <div style="position:absolute;left:0px;top:0px;width:100%;height:100%;">
 
<p align="center">
 
<br><br><br><br><br><br>
<img src="file:///C:\Documents and Settings\Administrateur\Mes documents\Mes images\TOONSEARCH.PNG"><br><br>
 
 
 
 
 
	<FORM METHOD = GET>
        <p align="center">
	<INPUT NAME="search" SIZE=35 MAXLENGTH=35>
	<INPUT TYPE="button" VALUE="Lancer la recherche..." onClick="base.Search(document.forms[0].elements[0].value)">
 
 
        </p>
        </FORM> 
 
</HEAD>
 
</body background> 
 
</FONT></TD></TR></TABLE>
</BODY></HTML>
Serait il possible de modifier ( else {window.location="http://www.google.fr/"; } ) afin de l'implémenter avec la
variable search ?

D'avance merci.

@+