main.js 734 B

12345678910111213141516171819
  1. var attempt = 333;
  2. function validate() {
  3. var username = document.getElementById("username").value;
  4. var password = document.getElementById("password").value;
  5. if (username == "admin" && password == "qwerty") {
  6. document.write("<div style='color:green'>Вы успешно зарегистрировались!</div>");
  7. return false;
  8. }
  9. else {
  10. attempt--;
  11. document.write("<div style='color:red'>Неверный логин или пароль!</div>");
  12. if (attempt == 0) {
  13. document.getElementById("username").disabled = true;
  14. document.getElementById("password").disabled = true;
  15. document.getElementById("submit").disabled = true;
  16. return false;
  17. }
  18. }
  19. }