main.js 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. // Simple calories calculator-------------------------------------------------------------------------
  2. // let breakfastEats = +prompt("How many calories do you eat for breakfast?", []);
  3. // let lunchEats = +prompt("How many calories do you eat for lunch?", []);
  4. // let dinnerEats = +prompt("How many calories do you eat for dinner?", []);
  5. // let caloriesOfTheDay = breakfastEats + lunchEats + dinnerEats;
  6. // if (caloriesOfTheDay > 1800) {
  7. // alert("You are eating too many calories");
  8. // } else {
  9. // alert(
  10. // "Everything is fine, you did not exceed the number of calories for the day"
  11. // );
  12. // }
  13. // Login form--------------------------------------------------------------------------------------------
  14. const box = document.body;
  15. function Input() {
  16. user_name = "";
  17. password = "";
  18. user_name = prompt("Login", []);
  19. user_name = user_name.toLowerCase();
  20. password = prompt("Password", []);
  21. password = password.toLowerCase();
  22. if (user_name == "admin" && password == "qwerty") {
  23. box.style.backgroundColor = "green";
  24. } else {
  25. box.style.backgroundColor = "red";
  26. }
  27. }