2020-07-14 16:58:57 +00:00
|
|
|
var elForm,elSelectedTheme1,elSelectedTheme2,currentTheme
|
|
|
|
mainbody = document.getElementById('mainbody');
|
|
|
|
currentTheme = document.getElementById('mainbody').getAttribute('class');
|
|
|
|
elForm = document.getElementById('form-theme');
|
|
|
|
elSelectedTheme1 = document.getElementById('exampleRadios1');
|
|
|
|
elSelectedTheme2 = document.getElementById('exampleRadios2');
|
|
|
|
console.log(elForm,elSelectedTheme1,elSelectedTheme2,currentTheme);
|
|
|
|
|
|
|
|
// document.querySelector('input[name="Theme"]:checked').value;
|
|
|
|
|
|
|
|
function selectTheme(e){
|
|
|
|
if(!elSelectedTheme1.checked && !elSelectedTheme2.checked){
|
|
|
|
// elSelectThemeHint.textContent = 'Devi selezionare almeno un tema!'
|
|
|
|
console.log('Devi selezionare almeno un tema!');
|
|
|
|
}else if (!elSelectedTheme2.checked){
|
|
|
|
var selectedTheme = elSelectedTheme1.value;
|
|
|
|
mainbody.className = selectedTheme;
|
|
|
|
}else{
|
|
|
|
var selectedTheme = elSelectedTheme2.value;
|
|
|
|
mainbody.className = selectedTheme;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-20 15:09:01 +00:00
|
|
|
elForm.addEventListener('change',function(e){
|
|
|
|
selectTheme(e)},
|
|
|
|
false);
|