Define Class over 'a' Syntax
<p>I caught a flaw in this script I'm using; It's calling the global 'a' tag - which is killing me.</p>

<p>What it the proper way to define a specific classes link within the 'a' tag within the snippet below?</p>

<pre><code>var allLinks = document.getElementsByTagName('.mainnav');
</code></pre>

<p>Clearly that didn't work; either did <code>.mainnav a</code></p>

<p><strong>Full snippet:</strong></p>

<pre><code>var ss = {
  fixAllLinks: function() {
    // Get a list of all links in the page
    var allLinks = document.getElementsByTagName('.mainnav');
    // Walk through the list
    for (var i=0;i&lt;allLinks.length;i++) {
      var lnk = allLinks[i];
      if ((lnk.href &amp;&amp; lnk.href.indexOf('#') != -1) &amp;&amp; 
          ( (lnk.pathname == location.pathname) ||
        ('/'+lnk.pathname == location.pathname) ) &amp;&amp; 
          (lnk.search == location.search)) {
        // If the link is internal to the page (begins in #)
        // then attach the smoothScroll function as an onclick
        // event handler
        ss.addEvent(lnk,'click',ss.smoothScroll);
      }
    }
  },
</code></pre>

<p><strong>Update:</strong> After swapping out different tags; and trying to call with classes the script stopped functioning. Here's the full plugin; <a href="http://www.kryogenix.org/code/browser/smoothscroll/" rel="nofollow">http://www.kryogenix.org/code/browser/smoothscroll/</a> I just want to use this with specific classes as opposed to all 'a' tags.</p>

<p>Suggestions; thanks.</p>
