title: Get value of HREF for links within a certain Class in Javascript
body: <p>I'm trying to process a page to find the value of href's within a certain div class. Please bear in mind I'm not using the class of the <code>&lt;a&gt;</code>.</p>
  
  <p>Here is what I have:</p>
  
  <pre><code>var domains = document.getElementsByClassName('r');
  for(var i = 0; i &lt; domains.length; i++){
  var hello = document.getElementsByClassName('r')[i].innerHTML;
  alert(hello);
  }
  </code></pre>
  
  <p>This works fine and will "alert" the content within the class. (I know this isn't well supported in IE but that's fine).</p>
  
  <p>I get an alert like:</p>
  
  <pre><code>&lt;a href="http://stackoverflow.com/questions/887307/getting-href-value-of-from-a-tag"    onmousedown="return     rwt(this,'','','','1','AFQjCNGsxCA6nMXughTW44nSEa94KtbEaQ','','0CC8QFjAA','','',event)"&gt;    &lt;em&gt;javascript&lt;/em&gt; - &lt;em&gt;getting href&lt;/em&gt; value of from &amp;lt;a&amp;gt; tag - Stack Overflow&lt;/a&gt;
  </code></pre>
  
  <p>What's the best way to get the value within the href?</p>
  
  <p>The HTML is like this: </p>
  
  <pre><code>&lt;h3 class="r"&gt;&lt;a onmousedown="return rwt(this,'','','','1','AFQjCNFgNBuo2EfLPoNBi3hGgbuTeLwODw','','0CC8QFjAA','','',event)" href="http://www.google.co.uk/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=1&amp;cad=rja&amp;ved=0CC8QFjAA&amp;url=http%3A%2F%2Fwww.w3schools.com%2Fjsref%2Fprop_html_innerhtml.asp&amp;ei=LacjUo4lw9m0BpLVgYAK&amp;usg=AFQjCNFgNBuo2EfLPoNBi3hGgbuTeLwODw&amp;bvm=bv.51495398,d.Yms"&gt; … &lt;/a&gt;&lt;/h3&gt;
  </code></pre>