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);