|
@@ -0,0 +1,70 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="en">
|
|
|
+<head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
+ <title>JS Homework 1</title>
|
|
|
+ <link rel="stylesheet" href="css/main.css">
|
|
|
+ <script src="js/index.js"></script>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+ <div class="contant">
|
|
|
+ <form name="froma" action="#" class="form">
|
|
|
+ <input type="text" id="loginEntry" placeholder="Enter your loign">
|
|
|
+ <input type="password" id="passwordEntry" placeholder="Enter your password">
|
|
|
+ <input class="btn" type="button" value="Login" onclick="isRight()">
|
|
|
+ </form>
|
|
|
+ <div id="printBlock"></div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+</body>
|
|
|
+</html>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+<!-- <!DOCTYPE html>
|
|
|
+<html>
|
|
|
+<head>
|
|
|
+ <meta charset="utf-8" />
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+<form name="search">
|
|
|
+ <input type="text" name="key" placeholder="Введите ключ"></input>
|
|
|
+ <input type="button" name="print" value="Печать" />
|
|
|
+</form>
|
|
|
+<div id="printBlock"></div>
|
|
|
+<script>
|
|
|
+var keyBox = document.search.key;
|
|
|
+
|
|
|
+// обработчик изменения текста
|
|
|
+function onchange(e){
|
|
|
+ // получаем элемент printBlock
|
|
|
+ var printBlock = document.getElementById("printBlock");
|
|
|
+ // получаем новое значение
|
|
|
+ var val = e.target.value;
|
|
|
+ // установка значения
|
|
|
+ printBlock.textContent = val;
|
|
|
+}
|
|
|
+// обработка потери фокуса
|
|
|
+function onblur(e){
|
|
|
+
|
|
|
+ // получаем его значение и обрезаем все пробелы
|
|
|
+ var text = keyBox.value.trim();
|
|
|
+ if(text==="")
|
|
|
+ keyBox.style.background = "red";
|
|
|
+ else
|
|
|
+ keyBox.style.background = "green";
|
|
|
+}
|
|
|
+// получение фокуса
|
|
|
+function onfocus(e){
|
|
|
+
|
|
|
+ // установка цвета границ поля
|
|
|
+ keyBox.style.borderColor = "blue";
|
|
|
+}
|
|
|
+keyBox.addEventListener("change", onchange);
|
|
|
+keyBox.addEventListener("blur", onblur);
|
|
|
+keyBox.addEventListener("focus", onfocus);
|
|
|
+</script>
|
|
|
+</body>
|
|
|
+</html> -->
|