grazie a tutti ma non riesco proprio a capire che cosa è che non va in questa funzione....davvero non ci riesco...qualcuno sa darmi qualche spiegazione? grazei mille..
Altro tentativo infruttuoso che ho fatto è stato questo:
codice:
<form name="test">
<input type="text" name="query" value=""/>
<input type="button" value="cerca" onclick="variante(sName[0]);"/>
<input type="button" value="cerca con googleimmagini" onclick="variante(sName[1]);"/> <input type="radio" name="checkgroup" value="stessa scheda" checked="checked" id="samePage" />
<input type="radio" name="checkgroup" value="nuova scheda" />
</form>
<script type="text/javascript"> function variante(a){
var sName = [];
sName[0]= "http://www.google.it/search?q=" + document.test.query.value;
sName[1]= "http://images.google.it/search?tbm=isch&hl=it&source=hp&biw=1920&bih=859&q=" + document.test.query.value;
for (i=0; i<2; i++) {
if(a===sName[i] && document.test.checkgroup[0].checked){ document.location.href=sName[i];
}else if (a===sName[i] && document.test.checkgroup[1].checked) { window.open(sName[i]); }
}
} </script>
Dove sbaglio?