What's wrong with my JavaScript function
<p>I'm testing this function in JavaScript Console of FireFox on this website:
<a href="http://www.google.com/search?hl=en&amp;tbo=d&amp;output=search&amp;sclient=psy-ab&amp;q=python" rel="nofollow">http://www.google.com/search?hl=en&amp;tbo=d&amp;output=search&amp;sclient=psy-ab&amp;q=python</a>
And Desired output is just text (.innerHTML) of each link.</p>

<pre><code>    parents = document.getElementsByClassName("r");
    function my_links() {
        links = {};
        for (var i=0; i&lt;parents.length; i++) {
            links[i] = parents[i].getElementsByTagName("a")[0];
        };
        return links;
    }
    elements = my_links();
    for (var i=0; i&lt;elements.length; i++) {
        g_link = elements[i].innerHTML;
        console.log(g_link + "\n");
    }
</code></pre>
