replace
onKeyDown="if(event.keyCode==13) event.keyCode=9;"
with
onkeyup="if(event.which === 13) TheLogin(this.form);"
or replace all the inline JS with
$('[name="login"]').on('submit', function() {
var password = 'pass1';
if ( $('[name="pass"]').val() == password) {
top.location.href="path_to_PDF.pdf";
} else {
location.href="incorrect.html";
}
});