I am currently able to dynamically change style rules using JS, but I feel that this is limiting. I would prefer to be able to swap entire CSS stylesheet files easily. Do you have any suggestions on how to accomplish this?
Here is my code:
<label>Themes :</label>
<select name="background" id="bg" onchange="changeBg(this)">
<option value="white">Default</option>
<option value="#444">Dark</option>
<option value="teal">Teal</option>
</select>
// Changing Themes
function changeBg(x){
var body = document.getElementById('body');
body.style.backgroundColor = x.value;
}
I also have multiple stylesheet definitions like the following:
<!-- Themes -->
<link type="text/css" rel="stylesheet" media="all" href="style.css" id="theme1_css">
<link type="text/css" rel="stylesheet" media="all" href="themes/dark.css" id="theme2_css">
<link type="text/css" rel="stylesheet" media="all" href="themes/teal.css" id="theme3_css">