prova così



codice:
<form name="myform" method="post" action="elabora.php">
   
   <table width="300" border="0" align="center">
     <tr>
       <td>Nome</td>
       <td>
         <input name="nome" type="text" />
       </td>
     </tr>
     <tr>
       <td>Cognome</td>
       <td>
	     <input name="cognome" type="text"/>
	   </td>
     </tr>
    </table>
   
   <p align="center">
     <input type="button" name="Registra" value="Registra" onclick="control()"/>
   </p>
 
</form>


<script language="javascript">

function control(){
	if (document.myform.nome.value=="")
		var answer = alert("Attenzione, non hai riempito il campo relativo al tuo nome!");
	else if (document.myform.cognome.value=="")
		var answer = alert("Attenzione, non hai riempito il campo relativo al tuo cognome!");
	else
		document.myform.submit();

}
</script>