|
@@ -0,0 +1,169 @@
|
|
|
+function wearSizeTb() {
|
|
|
+let wearSizeTbFirst = document.querySelector('.firstTb');
|
|
|
+let wearSizeTbSecond = document.querySelector('.secondTb');
|
|
|
+let wearSizeTbThird = document.querySelector('.thirldTb');
|
|
|
+let wearSizeTbFourth = document.querySelector('.fourthTb');
|
|
|
+let wearSizeTbFifth = document.querySelector('.fifthTb');
|
|
|
+let wearSizeTbSixth = document.querySelector('.sixthTb');
|
|
|
+let wearSizeTbSeventh = document.querySelector('.seventhTb');
|
|
|
+let wearSizeTbEighth = document.querySelector('.eighthTb');
|
|
|
+let wearSizeNumber = prompt("Введите размер одежды", "");
|
|
|
+switch (wearSizeNumber){
|
|
|
+ case "42": wearSizeTbFirst.classList.add('active');
|
|
|
+ break;
|
|
|
+ case "40": wearSizeTbSecond.classList.add('active');
|
|
|
+ break;
|
|
|
+ case "44": wearSizeTbThird.classList.add('active');
|
|
|
+ break;
|
|
|
+ case "46": wearSizeTbFourth.classList.add('active');
|
|
|
+ break;
|
|
|
+ case "48": wearSizeTbFifth.classList.add('active');
|
|
|
+ break;
|
|
|
+ case "50": wearSizeTbSixth.classList.add('active');
|
|
|
+ break;
|
|
|
+ case "52": wearSizeTbSeventh.classList.add('active');
|
|
|
+ break;
|
|
|
+ case "54": wearSizeTbEighth.classList.add('active');
|
|
|
+ break;
|
|
|
+ default: '';
|
|
|
+}
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+// пример с if //
|
|
|
+
|
|
|
+// if (wearSizeTbFirst == '42') {
|
|
|
+// wearSizeTbFirst.classList.add('active')
|
|
|
+// } elise
|
|
|
+// if (wearSizeTbSecond == '40') {
|
|
|
+// wearSizeTbSecond.classList.add('active')
|
|
|
+// } elise
|
|
|
+// if (wearSizeTbThird == '40') {
|
|
|
+// wearSizeTbThird.classList.add('active')
|
|
|
+// } elise
|
|
|
+// if (wearSizeTbFourth == '40') {
|
|
|
+// wearSizeTbFourth.classList.add('active')
|
|
|
+// }
|
|
|
+
|
|
|
+function old() {
|
|
|
+ let years = prompt('How old are you ?')
|
|
|
+ if (years == '' || years == null) {
|
|
|
+ alert('Повторите ещё раз')
|
|
|
+ } else {
|
|
|
+ alert('You were born in ' + (2020 - years))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let whenBorn = document.querySelector('.how-old-are-you')
|
|
|
+ whenBorn.onclick = function() {
|
|
|
+ old();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+function confirmA() {
|
|
|
+ let idiot = confirm('шопинг ?')
|
|
|
+ if (idiot == '') {
|
|
|
+ alert('ты - бяка')
|
|
|
+ } else {
|
|
|
+ alert('Nice !')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let confirmShow = document.querySelector('.confirm')
|
|
|
+ confirmShow.onclick = function() {
|
|
|
+ confirmA();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+function triplePrompt() {
|
|
|
+ let name = prompt('Введите ваше имя');
|
|
|
+ let surname = prompt('Введитк вашу фамилию');
|
|
|
+ let fatherName = prompt('Введите ваше отчество');
|
|
|
+
|
|
|
+ if (name == '' || name == null) {
|
|
|
+ name = 'Иван';
|
|
|
+ }
|
|
|
+ if(surname == '' || surname == null) {
|
|
|
+ surname = 'Иванов';
|
|
|
+ } if (fatherName == '' || fatherName == null){
|
|
|
+
|
|
|
+ fatherName = 'Иванович';
|
|
|
+ }
|
|
|
+ alert(surname + ' ' + name + ' ' + fatherName);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+function calculator() {
|
|
|
+ let askCurrency = prompt('Ввеидте валюту USD или EUR').toLowerCase();
|
|
|
+ let askQuantity = prompt('Ввеидте велечену суммы в грн').toLowerCase();
|
|
|
+ let usd = 28;
|
|
|
+ let eur = 33;
|
|
|
+ switch (askCurrency) {
|
|
|
+ case 'usd': alert(usd * askQuantity + ' грн');
|
|
|
+
|
|
|
+ break;
|
|
|
+ case 'eur': alert(eur * askQuantity + ' грн');
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+// function calculatorTwo() {
|
|
|
+// let usdBuy = 28.1;
|
|
|
+// let usdSell = 28.3;
|
|
|
+// let eurBuy = 33;
|
|
|
+// let eurSell = 33.4;
|
|
|
+// let askCurrency = prompt('Ввеидте валюту USD или EUR').toLowerCase();
|
|
|
+// let askQuantity = prompt('Ввеидте велечену суммы в грн').toLowerCase();
|
|
|
+// let askBuyOrSell = prompt('Введите "покупка" или "продажа" для выбора обенного курса').toLowerCase();
|
|
|
+// askBuyOrSell ? "покупка" || "продажа":
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+let userChoice = prompt('Камень, ножницы, бумага').toLowerCase();
|
|
|
+let myChoice = Math.random();
|
|
|
+if(myChoice < 0.34) {
|
|
|
+ myChoice = "камень";
|
|
|
+} else if (myChoice <= 0.67) {
|
|
|
+ myChoice = "бумага";
|
|
|
+} else {
|
|
|
+ myChoice = "ножницы";
|
|
|
+}
|
|
|
+function compare(userChoice, myChoice) {
|
|
|
+ if(userChoice == myChoice) {
|
|
|
+ alert("У меня: " + myChoice);
|
|
|
+ alert('ничья');
|
|
|
+ }
|
|
|
+ if(userChoice == "камень"){
|
|
|
+ if(myChoice == "ножницы"){
|
|
|
+ alert("У меня: " + myChoice);
|
|
|
+ alert('ты победил');
|
|
|
+ } else {
|
|
|
+ alert("У меня: " + myChoice);
|
|
|
+ alert('ты проиграл');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(userChoice == "бумага") {
|
|
|
+ if(myChoice == "камень") {
|
|
|
+ alert("У меня: " + myChoice);
|
|
|
+ alert('ты победил');
|
|
|
+ } else {
|
|
|
+ alert("У меня: " + myChoice);
|
|
|
+ alert('ты проиграл')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(userChoice == "ножницы") {
|
|
|
+ if(myChoice == "бумага") {
|
|
|
+ alert("У меня: " + myChoice);
|
|
|
+ alert("ты победил")
|
|
|
+ } else {
|
|
|
+ alert("У меня: " + myChoice)
|
|
|
+ alert('ты проиграл')
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+console.log(userChoice);
|
|
|
+console.log(myChoice);
|
|
|
+compare(userChoice, myChoice);
|