主にWEB関連の覚え書き。たまに実験もしてみる。

2009年12月26日土曜日

画像検索API


Loading images...

ソース

<style type="text/css">
  @import url("http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.css");
</style>

<!--script src="http://www.google.com/jsapi?key=xxxx"></script-->
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript"><!--
/*
*  The Hello World of the AJAX Search API
*/

google.load('search', '1');

function OnLoad() {
  // Create a search control
  var searchControl = new google.search.SearchControl();
  var searchFormElement = document.getElementById("hani-images");
  var drawOptions = new google.search.DrawOptions();
  var searchOptions = new google.search.SearcherOptions();


  searchOptions.setExpandMode(google.search.SearchControl.EXPAND_MODE_PARTIAL);
  searchControl.addSearcher(new google.search.ImageSearch(), searchOptions);
  
  drawOptions.setSearchFormRoot(searchFormElement);
  drawOptions.setDrawMode(google.search.SearchControl.DRAW_MODE_LINEAR);

  // tell the searcher to draw itself and tell it where to attach
  searchControl.draw(searchFormElement, drawOptions);

  // execute an inital search
  searchControl.execute("ハニー");
  searchControl.execute("ハニワ");
  searchControl.execute("土偶");
}

google.setOnLoadCallback(OnLoad);
-->
</script>

<hr style="clear:both;">
<div id="hani-images">Loading images...</div>
<hr style="clear:both;">

0 件のコメント:

コメントを投稿