Ciao ragazzi,
qui sotto vi ho postato un po' di codice di una pagina php. Il problema che vi chiedo di risolvere non è legato al php ma è un po' più generico.
La pagina prova2.php, come potete vedere, contiene un campo di testo e un bottone.
La domanda è la seguente:
perchè quando scrivo un qualcosa nel campo di testo e premo invio mi ricarica la pagina anche se non ho impostato un evento keypress????
come posso evitare questo?

<script language="javascript" type="text/javascript">
var myRequest = null;
alert("ffff");
function CreateXmlHttpReq2(handler) {
var xmlhttp = null;
try {
xmlhttp = new XMLHttpRequest();
} catch(e) {
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
xmlhttp.onreadystatechange = handler;
return xmlhttp;
}

function myHandler2() {
if (myRequest.readyState == 4 && myRequest.status == 200) {
e = document.getElementById("ex4result");
e.innerHTML = myRequest.responseText;
}
}

function esempio4() {
var nome = document.f1.nome.value;
var r = Math.random();
myRequest = CreateXmlHttpReq2(myHandler2);
myRequest.open("GET","secondo.php?nome="+escape(no me)+"&rand="+escape(r));
myRequest.send(null);
}
</script>
<form action="prova2.php" onkeypress="" method="post" name="f1">
Nome: <input type="input" name="nome">
<input type="button" onClick="esempio4()" value="Visualizza cognome" />

Risultato: <div id="ex4result"></div>
</form>

Grazie