find specific links that contain a word and add to array
<p>I am trying to search a page for links that contain the word playgame. If they found then I add them to an array. After that Select a random value from the array and use <code>window.location</code>. My problem is that it says my <code>indexof</code> is undefined. I not sure exactly that what means as I am still learning to use this feature of javascript.</p>

<p>example of link</p>

<pre><code>&lt;a href="playgame.aspx?gid=22693&amp;amp;tag=ddab47a0b9ba5cb4"&gt;&lt;img src="http://games.mochiads.com/c/g/running-lion-2/_thumb_100x100.jpg"&gt;&lt;/a&gt;
</code></pre>

<p>javascript</p>

<pre><code>var gameLinks = document.getElementsByTagName("a");
if (gameLinks.href.indexOf("playgame") != -1) {
    var links = [];
    links.push(gameLinks.href);
    var randomHref = links[Math.floor(Math.random() * links.length)];
    window.location = randomHref;
}
</code></pre>
