import statement
Javascript
code posted
by
Israel Sant'Anna
created at 02 Sep 00:55, updated at 10 Nov 22:25
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
{ function toggleTheme() { var theme = document.getElementsByClassName('themeChanger'); var bodyPic = document.getElementsByTagName('body'); var styleChanger = document.getElementById('styleRange'); // Change the value of media attribute // to change the css sheet active. if (styleChanger.value == '1') { theme[0].setAttribute('media', 'none'); theme[1].setAttribute('media', ''); theme[2].setAttribute('media', 'none'); bodyPic[0].setAttribute('style', "font-family: Tahoma, sans-serif; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; background-size: 100% 100%; background-color: white; background-image: url('assets/images/win98.png');"); } else if (styleChanger.value == '2') { theme[1].setAttribute('media', 'none'); theme[0].setAttribute('media', ''); theme[2].setAttribute('media', 'none'); bodyPic[0].setAttribute('style', "font-family: 'Franklin Gothic', sans-serif; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; background-size: 100% 100%; background-color: white; background-image: url('assets/images/bliss.jpg');"); } else { theme[2].setAttribute('media', ''); theme[0].setAttribute('media', 'none'); theme[1].setAttribute('media', 'none'); bodyPic[0].setAttribute('style', "font-family: sans-serif; background-color: azure;"); } } } |
1.61 KB in 2 ms with coderay