<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>js</title>
</head>
<body>
<form id="main"method="post" onsubmit="return checkForm(this)" >
<label for="name">Имя:</label>
<input type="text" name="name" placeholder="Имя" id="name"><br><br>
<label for="password">Пароль:</label>
<input type="password" name="pass" placeholder="Паоль" id="pass"><br><br>
<label for="repass">Проверка пароля:</label>
<input type="password" name="repass" placeholder="Проверка пароля" id="repass"><br><br>
<span>Пол:</span>
<input type="radio" name="state" id="male" value="Мужской">
<label for="male">Мужской</label>
<input type="radio" name="state" id="female" value="Женский">
<label for="female">Женский</label><br><br>
<div id="eroor" style="color: brown;"></div>
<input type="submit" name="submit" value="Готово">
</form>
<script src="js/baba.js"></script>
</body>
</html>
function checkForm(el) {
var name = el.name.value;
var pass = el.pass.value;
var repass = el.repass.value;
var state = le.state.value;
var fail
if ( name == "" || pass == "" || state == "")
fail = "Заполните все поля";
else if (name.length <=1 || name.length > 50 )
fail = "Введите коректное время";
else if (pass != repass)
fail = "Пороль не совпадают! ";
else if (pass.split ("!@#$%^&*()_+=").length > 1)
fail = "НЕльзя вводить знаки: !@#$%^&*()_+="
if (fail != " ") {
document.getElementById('error').innerHTML = fail;
return false;
} else {
alert("Все данные коректны");
return true;
}
}