title: JavaScript Add Class When Link is Clicked
body: <p>I have these links:</p>
  
  <pre><code>&lt;a class="active" href="#section1"&gt;Link 1&lt;/a&gt; 
  &lt;a href="#section2"&gt;Link 2&lt;/a&gt;
  </code></pre>
  
  <p>When a link 2 is clicked I would like it to receive the active class and remove the class from link 1 itself so it would effectively become:</p>
  
  <pre><code>&lt;a href="#section1"&gt;Link 1&lt;/a&gt; 
  &lt;a class="active" href="#section2"&gt;Link 2&lt;/a&gt;
  </code></pre>
  
  <p>This should work both ways.  Ie. whatever link is clicked gets the class and removes it from the other.</p>
  
  <p>How can this be done with JavaScript/Prototype?</p>