У меня есть оператор switch, который не распознает входные данные. Он всегда возвращает значение по умолчанию ...
Как видите, я добавил onclick="rewrite("value")"
, а также значение в поле ввода.
У меня есть несколько других операторов switch, которые работают так что я действительно почесываю свою голову здесь ...
Поскольку мне больше нечего добавить, я просто добавляю текст сюда, чтобы он мог отправить.
Любой помощь будет приветствоваться.
<div>
<input type="image" value="sl" class="zastave" src="assets/drzave/Slo.png" onclick="rewrite('sl'); setInputs('sl');">
<input type="image" value="en" class="zastave" src="assets/drzave/Ang.png" onclick="rewrite('en'); setInputs('en');">
<input type="image" value="de" class="zastave" src="assets/drzave/Nem.png" onclick="rewrite('de'); setInputs('de');">
<input type="image" value="it" class="zastave" src="assets/drzave/Ita.png" onclick="rewrite('it'); setInputs('it');">
<input type="image" value="hr" class="zastave" src="assets/drzave/Hrv.png" onclick="rewrite('hr'); setInputs('hr');">
<input type="image" value="ru" class="zastave" src="assets/drzave/Rus.png" onclick="rewrite('ru'); setInputs('ru');">
</div>
function rewrite(){
let smol = document.getElementById("small");
let advT = document.getElementById("adv-t");
let advC = document.getElementById("adv-c");
let a = document.getElementById("a");
let d = document.getElementById("d");
switch (rewrite){
case "sl":
advT.innerHTML = '';
advC.innerHTML = '';
smol.innerHTML = '';
a.innerHTML = '';
d.innerHTML = '';
advT.innerHTML = 'Do you want to recieve our emails?';
advC.innerHTML = 'Yes, send me emails.';
smol.innerHTML = 'I agree to whatever you say. We don`t read small print';
a.innerHTML = 'Agree';
d.innerHTML = 'Disagree';
break;
case "en":
advT.innerHTML = '';
advC.innerHTML = '';
smol.innerHTML = '';
a.innerHTML = '';
d.innerHTML = '';
advT.innerHTML = 'X Do you want to recieve our emails?';
advC.innerHTML = 'X Yes, send me emails.';
smol.innerHTML = 'X I agree to whatever you say. We don`t read small print';
a.innerHTML = 'X Agree';
d.innerHTML = 'X Disagree';
break;
case "de": advT.innerHTML = '';
advC.innerHTML = '';
smol.innerHTML = '';
a.innerHTML = '';
d.innerHTML = '';
advT.innerHTML = 'Y Do you want to recieve our emails?';
advC.innerHTML = 'Y Yes, send me emails.';
smol.innerHTML = 'Y I agree to whatever you say. We don`t read small print';
a.innerHTML = 'Y Agree';
d.innerHTML = 'Y Disagree';
break;
case "it":
advT.innerHTML = '';
advC.innerHTML = '';
smol.innerHTML = '';
a.innerHTML = '';
d.innerHTML = '';
advT.innerHTML = 'Z Do you want to recieve our emails?';
advC.innerHTML = 'Z Yes, send me emails.';
smol.innerHTML = 'Z I agree to whatever you say. We don`t read small print';
a.innerHTML = 'Z Agree';
d.innerHTML = 'Z Disagree';
break;
case "hr":
advT.innerHTML = '';
advC.innerHTML = '';
smol.innerHTML = '';
a.innerHTML = '';
d.innerHTML = '';
advT.innerHTML = 'XX Do you want to recieve our emails?';
advC.innerHTML = 'XX Yes, send me emails.';
smol.innerHTML = 'XX I agree to whatever you say. We don`t read small print';
a.innerHTML = 'XX Agree';
d.innerHTML = 'XX Disagree';
break;
case "ru":
advT.innerHTML = '';
advC.innerHTML = '';
smol.innerHTML = '';
a.innerHTML = '';
d.innerHTML = '';
advT.innerHTML = 'XY Do you want to recieve our emails?';
advC.innerHTML = 'XY Yes, send me emails.';
smol.innerHTML = 'XY I agree to whatever you say. We don`t read small print';
a.innerHTML = 'XY Agree';
d.innerHTML = 'XY Disagree';
break;
default:
advT.innerHTML = '';
advC.innerHTML = '';
smol.innerHTML = '';
a.innerHTML = '';
d.innerHTML = '';
advT.innerHTML = 'XZ Do you want to recieve our emails?';
advC.innerHTML = 'XZ Yes, send me emails.';
smol.innerHTML = 'XZ I agree to whatever you say. We don`t read small print';
a.innerHTML = 'XZ Agree';
d.innerHTML = 'XZ Disagree';
break;
}
};