Pagina 1 din 1

Modificare action la Select

Scris: Vin Oct 29, 2010
de nutzu123
Salut! Am si eu o problema de cautarea-n site:

Cod: Selectaţi tot

<form action="search.php" method="post">
<input type="text" name="search" maxlength="40" />
<select name="alege">
<option value="">alege</option>
<option value="Muzica">Muzica</option>
<option value="Audio">Audio</option>
<option value="Video">Video</option>
</select>
<input type="submit" name="submit" value="Cauta" />
</form>	
Adica atunci cand aleg "Muzica" sa imi caute in search.php cand aleg "Audio" sa imi caute in search2.php si cand aleg "Video" sa imi caute in search3.php

Se poate asa ceva? Astept un raspuns!
Cu respect Nutzu! ;)

Modificare action la Select

Scris: Sâm Oct 30, 2010
de MarPlo
Se poate cu JavaScript, asa:

Cod: Selectaţi tot

<script type="text/javascript">
var pags = new Array();
 pags['Muzica'] = 'search.php';
 pags['Audio'] = 'search2.php';
 pags['Video'] = 'search3.php';

function changepg(val) {
  document.numf.action = pags[val];
}
</script>
<form action="search.php" method="post" name="numf">
<input type="text" name="search" maxlength="40" />
<select name="alege" onchange="changepg(this.value)">
<option value="">alege</option>
<option value="Muzica">Muzica</option>
<option value="Audio">Audio</option>
<option value="Video">Video</option>
</select>
<input type="submit" name="submit" value="Cauta" />