<form action="register.php" method="post" onsubmit="return verify_passwords(password, passwordconfirm);">
<input type="password" name="password" />
<input type="password" name="passwordconfirm" />
<input type="submit" value="Отправить!" />
</form>
<script type="text/javascript">
<!--
function verify_passwords(password1, password2)
{
if (password1.value != password2.value)
{
alert('Введённые пароли не совпадают.');
return false;
}
else
{
return true;
}
}
-->
</script>