Edit in JSFiddle

(function() {
    var o = document.getElementById('protect-overlay');
    o.getElementsByTagName('form')[0].onsubmit = function() {
        if (this.answer.value === '123') {
            o.style.display = "none";
        } else {
            alert('Неправильный пароль!');
        }
        return false;
    };
})();
<div id="protect-body" class="body">Вы угадали пароль!</div>

<div id="protect-overlay" class="overlay">
    <form action="#">
        <input name="answer" type="password" placeholder="Введите пароль"/> <button type="submit">Открыть страницу</button>
    </form>
</div>
.body {
  padding:10% 0;
  text-align:center;
}
.overlay {
  position:fixed;
  top:0;
  right:0;
  bottom:0;
  left:0;
  z-index:9999;
  background-color:black;
  color:white;
  padding:10% 0;
  text-align:center;
}