title: How can you change the attached CSS file with Javascript?
body: <p>I was wondering, is it possible to change the attached stylesheet using JavaScript?</p>
  
  <p>For example:</p>
  
  <pre><code>&lt;link href="stylesheet.css" rel="stylesheet" type="text/css"&gt;
  .....
  &lt;div id="controls"&gt;
      &lt;div id="red" onClick="styler(1)"&gt;R&lt;/div&gt;
      &lt;div id="green" onClick="styler(2)"&gt;G&lt;/div&gt;
      &lt;div id="blue" onClick="styler(3)"&gt;B&lt;/div&gt;
      &lt;div id="reset" onClick="styler(4)"&gt;Reset&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>JavaScript</p>
  
  <pre><code>function styler(attr){
      switch(attr){
           case'1':document.----- = "stylesheet1.css";break;
           case'2':document.----- = "stylesheet2.css";break;
           case'3':document.----- = "stylesheet3.css";break;
           case'4':document.----- = "stylesheet.css";break;
           default:;break;
       }
  }
  </code></pre>