views:

25

answers:

0

Hello everyone. I am using the simple Google API to display search results. I would like to get the href value of a link on mouseover or click. It is really not important what flavor of javascript is used, I just need to get the user selected href value of the rendered search.

(I need this as I have a webservice that allows users to save links they find of interest.)

I am horrible at client side scripting so I could really use a hand. With the example here I using the default Google AJAX Search API Sample.

To visually explain I have posted this image. (cannot attach)

I have used the link stackoverflow.com/questions/2098408/how-to-get-href-value-using-jquery for simple reference to no avail. I believe it is due to the way/page render order that the google search results are displayed.

The html source pre render is as follows:

<!--

copyright (c) 2009 Google inc. You are free to copy and use this sample. License can be found here: code.google.com/apis/ajaxsearch/faq/#license --> Google AJAX Search API Sample /* * How to do a search that returns the max number of results per page. */ google.load('search', '1'); function OnLoad() {

  // create a search control
  var searchControl = new google.search.SearchControl();

  // Set the Search Control to get the most number of results
  searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET);

  // Create 2 searchers and add them to the control
  searchControl.addSearcher(new google.search.WebSearch());
  searchControl.addSearcher(new google.search.BlogSearch());

  // Set the options to draw the control in tabbed mode
  var drawOptions = new google.search.DrawOptions();
  drawOptions.setDrawMode(google.search.SearchControl.DRAW_MODE_TABBED);

  // Draw the control onto the page
  searchControl.draw(document.getElementById("content"), drawOptions);

  // Search!
  searchControl.execute("Subaru STI");
}
google.setOnLoadCallback(OnLoad);

</script>

<div id="content">Loading...</div>

The relevent rendered result html source is as follows:

 <div class="gs-webResult gs-result">
                    <div class="gs-title">
                        <a class="gs-title" href="http://en.wikipedia.org/wiki/Subaru_Impreza_WRX_STI" target="_blank">
                        <b>Subaru</b> Impreza WRX <b>STI</b> - Wikipedia, the free encyclopedia</a></div>

If anyone can point me in the right direction I would really appreciate it. Thanks a million, Dave