Problème javascript recherche.

tazanet -  
 MICHEL le Magicien -
Bonjour,

J'ai un formulaire de recherche en javascript qui marche voila le code:


	<script type="text/javascript" src="recherche.js">
	
<form method="post" name="log1" action="" >

<input type="text"  class="text" name="T1" value="" style="width: 200px;" />

<select class="options" name="D1" style="width: 200px;">
<option value="y">Musique</option>
<option value="s">Paroles de chansons</option>
<option value="r">Vidéos-clips</option>
<option value="l">Téléchargement (MP3)</option>
<option value="d">Actualités</option>
<option value="k">Interviews</option>

</select> 


<img border="0" src="http://www.ournia.com/templates/xhtml/form-recherche/recherche.gif" title="Search" onClick="search()" style="cursor:hand">
</form>



Il marche mais il ya un petit problème quand on ecrit un mot et en valide par entrée sa ne donne rien .
Il faut obligatoirement cliquer sur l'image rechercher!

Merci de me donner une modification de telle sorte que quand:
- On tape un mot clé puis on valide par entrée sa effectue la recherche
-On tape un mot clé et on choisit un type de recherche sa effectue la recherche.

Merci beaucoup
Configuration: Mac OS X
Firefox 2.0.0.11

3 réponses

  1. MICHEL le Magicien
     
    Bonjour

    J’ai utiliser le script qui suit sur toute les pages de mon site cela est super avec IE mais

    cela ne fonctionne pas avec FIREFOX est-ce normal

    Une Image qui Suit la Souris 2
    1
  2. tazanet
     
    le code de recherche.js est

    var g,ch;
    function search()
    {
    g=document.log1.T1.value;
    ch=document.log1.D1.value;
    
    if(g=='' || g==null){
    alert("Saisissez un mot-clé pour effectuer une recherche!");
    document.log1.T1.focus();
    }else{
    
    if(ch=="y")
    window.location="http://www.ournia.com/search.php?search_query=" + g + "&search_do_advanced=1&search_cid[]=0";
    if(ch=="s")
    window.location="http://www.ournia.com/paroles/search.php?c=" + g;
    if(ch=="r")
    window.location="http://www.ournia.com/video/clip-" + g + ".html";
    if(ch=="l")
    window.location="http://www.ournia.com/mp3/" + g + ".html";
    if(ch=="d")
    window.location="http://www.ournia.com/search.php?search_query=" + g + "&search_do_advanced=1&search_cid[]=2";
    if(ch=="k")
    window.location="http://www.ournia.com/search.php?search_query=" + g + "&search_do_advanced=1&search_cid[]=31";
    }
    }
    var sto="Click here to download the font required by my site!"
    var sta="Done"
    0