//Первая часть ДЗ // let tomato = +prompt("Сколько помидор?"); // let cucumber = +prompt("Сколько огурцов?"); // let onion = +prompt("Сколько лука?"); // let apple = +prompt("Сколько яблок?"); // let orange = +prompt("Сколько апельсин?"); // let kiwi = +prompt("Сколько киви?"); // let vegitables = tomato + cucumber + onion; // alert(`Всего ${vegitables} овощей`); // let fruits = apple + orange + kiwi; // alert(`Всего ${fruits} фруктов`); // alert(`Всего ${vegitables + fruits} фруктов и овощей вместе`); //Вторая часть ДЗ var credentials = { login: 'admin', password: 'qwerty', }; let log = document.getElementById('login'); let pswd = document.getElementById('password'); let btn = document.getElementById('btn'); btn.onclick = function() { let col; let text; if (log.value == credentials.login && pswd.value == credentials.password) { col = 'green'; text = 'Congratulations'; } else { col = 'red'; text = 'Error'; } let div = document.createElement('div'); btn.insertAdjacentElement('afterend', div); div.style.background = col; div.innerText = text; }