I have this HTML code at the moment:
Theme
- Choose theme
-
Demo: http://jsfiddle.net/zYMFa/
Use values for options and handle change event for select. The value property of select gets value of the selected option, so you can use this.value in change function.
<form>
<select id="myList" >
<option value="default">Default</option>
<option value="theme1">Theme 1</option>
<option value="theme2">Theme 2</option>
<option value="theme3">Theme 3</option>
</select>
<form>
document.getElementById("myList").onchange = function() {
setActiveStyleSheet(this.value);
return false
};
<select id="myList" >
<option id="stylesheet1" value="default">Default</option>
<option id="stylesheet2" value="one">Theme 1</option>
<option id="stylesheet3" value="two">Theme 2</option>
<option id="stylesheet4" value="three">Theme 3</option>
</select>
document.getElementById("myList").onchange = function() {
var sheet=document.getElementById("myList").value;
if(sheet=="one"){
setActiveStyleSheet("theme1");
}
else if(sheet=="two"){
setActiveStyleSheet("theme2");
}
else if(sheet=="three"){
setActiveStyleSheet("theme3");
}
else{
setActiveStyleSheet("default");
}
return false
};