find all href based on class
<p>I am trying to find all <code>&lt;a&gt;</code> tags with a class of a_tv and based on that get their href attribute value. I have the following code, but it returns undefined. What am I doing wrong?</p>

<pre><code>var hrefs, randomHref;

hrefs = Array.prototype.filter.call(document.getElementsByTagName("a"), function(node) { 
    return node.class.indexOf("a_tv") === 0;
}).map(function(node) {
    return node.href;
});

randomHref = hrefs[Math.floor(Math.random() * hrefs.length)];
console.log(randomHref);
</code></pre>
