Title / Description
Code { 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;"); } } }
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code