v.classic,
<!DOCTYPE html>
<html>
<head>
<title>Форма регистрации</title>
<meta charset="utf-8">
<style type="text/css">
[title="err"]{
border: solid 2px red;
}
</style>
</head>
<body>
<form class="form" action="address.txt" method="get" >
<input id="password" name="password" type="password" placeholder="Пароль" >
<input id="password-check" name="password-check" type="password" placeholder="Подтверждение пароля" title="" >
<input id="submit" name="submit" type="submit" value="Создать аккаунт">
</form>
<script>
window.addEventListener('DOMContentLoaded', function() {
var form = document.querySelector('.form'),
pas = form.querySelectorAll('#password, #password-check');
form.addEventListener('submit', function(e) {
var err = !(pas[0].value && (pas[0].value == pas[1].value))
pas[1].setAttribute("title", err ? 'err' : '');
err && e.preventDefault();
}, false);
pas[1].addEventListener('input', function(e) {
var err = !(pas[0].value == pas[1].value)
pas[1].setAttribute("title", err ? 'err' : '');
}, false);
});
</script>
</body>
</html>