Quantcast
Channel: User Michael Paulukonis - Stack Overflow
Viewing all articles
Browse latest Browse all 44

Answer by Michael Paulukonis for execute google image search several times in a page

$
0
0

The hi function doesn't make a lot of sense to me:

function hi(){    keyword="usa";    alert('hi');    google.setOnLoadCallback(OnLoad);    imageSearch.execute(keyword);}

Because the onLoadCallbak has already been set, and a search executed in OnLoad. This is called when the search library has loaded. Which only happens once, at some point after the page has loaded.

What you need to do in hi is the same thing you're doing in OnLoad:

// Create an Image Search instance.imageSearch = new google.search.ImageSearch();// set a DIFFERENT callback (if different handling require)imageSearch.setSearchCompleteCallback(this, searchComplete, null);// set "keyword" to what your next search should be forimageSearch.execute(keyword);

Viewing all articles
Browse latest Browse all 44

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>