Following on from last timelast time.
Next comes the javascript. This script is "borrowed" from Paul Sowden‘s excellent article on A List Apart, Alternative Style: Working With Alternate Style Sheets. Here’s the script:
function setActiveStyleSheet(title) {
var i, a, main;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1
&& a.getAttribute("title")) {
a.disabled = true;
if(a.getAttribute("title") == title) a.disabled = false;
}
}
}
You’ll need to include this on any page you want this to work on, either in script tags in the page, or in an externally linked javascript file.