<script type="text/javascript">
function achat_change_themes() {
var rel = $('link[title="chat_theme"]');
var select = $('#achat_times').attr('value');
if(select == "GrayScale") {
rel.attr('src' , 'www.avacwebthemes.vacau.com/css/mario_theme.css');
}
else if (select == "Mario") {
rel.attr('src' , 'www.avacwebthemes.vacau.com/css/mario_theme.css');
}
else if (select == "Eartone") {
rel.attr('src' , 'www.avacwebthemes.vacau.com/css/mario_theme.css');
}
else if (select == "Dark") {
rel.attr('src' , 'www.avacwebthemes.vacau.com/css/mario_theme.css');
}
else if (select == "Floral") {
rel.attr('src' , 'www.avacwebthemes.vacau.com/css/mario_theme.css');
}
else if (select == "Military") {
alert(www.avacwebthemes.vacau.com/css/mario_theme.css);
}
}
</script>
THE HTML MOCK
<select id="achat_themes" onChange="achat_change_themes();">
<option value="GrayScale">GrayScale</option>
<option value="Mario">Mario</option>
<option value="EarthTone">EarthTone</option>
<option value="Dark">Dark</option>
<option value="Floral">Floral</option>
<option value="Military">Military</option>
</select>
Basically what I want to do is on the change event of the select it will change the src of the link tag in the head...such as
<link type="text/css" rel="stylesheet" title="chat_theme" href="http://sourcefile.com/css/file.css">
And would like to change it each time I have the last selection alerted out for when I was testing this, just something 5 mins threw together, and trying out the javascript function with jQuery. It is not running any suggestions?
I tried taking out the entire inner code and I keep getting achat_change_themes undefined? I must be writing the function incorrectly?