codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Documento senza titolo</title>
  <script type="text/javascript">
  function verificapas(pas){
  //verifico le lunghezze dei due campi
  if(pas.value.length == document.getElementById('psw').value.length){
  //verifico i due campi
  if(pas.value!=document.getElementById('psw').value){
  //mostro l'avviso d'errore
  document.getElementById('error').innerHTML='Password e conferma password diverse';
  //cancello il campo conferma
  pas.value='';
  }
  //mostro a video che i dati sono corretti, può essere eliminata
  else{document.getElementById('error').innerHTML='Conferma password corretta';}
  }
  }
  </script>
  <style type="text/css">
  #error{color:#990000}
  </style>
  </head>
  <body>
  <form action="" method="get">
  <input name="psw" id="psw" type="text" />
  <input name="confPsw" id="confPsw" type="text" onkeyup="document.getElementById('error').innerHTML='';verificapas(this)" />
  <span id="error"></span>
  </form>
  </body>
  </html>
La prossima volta apri una discussione tua, non riesumare una discussione di 4 anni fa.
Volendo con i dovuti adattamenti potresti usarla anche per l'altra discussione (verifica email).
Ciao.