ddadmin2009
Programmer
Actually I was trying to use this imagesearch code
for one of my blog posts about cars, I want to embed the below codes
one for BMW and one for Toyota in the blog post, individually if I
place one of these codes they work fine but if I want to place them
both together in 2 different blocks separately it doesn't work. Is
there a way to achieve this, basically giving 2 different handlers.
This will help me a lot - TIA.
<script type="text/javascript" src="key=ABQIAAAA1XbMiDxx_BTCY2_FkPh06RRaGTYH6UMl8mADNa0YKuWNNa8VNxQEerTAUcfkyrr 6OwBovxn7TDAH5Q"></
script><div id="TOYOTA">Loading...</div><script type="text/
javascript">google.load('search', '1');var imageSearch;function
OnLoadSneha() { imageSearch = new google.search.ImageSearch();
imageSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);
imageSearch.setRestriction
(google.search.ImageSearch.RESTRICT_IMAGESIZE,
google.search.ImageSearch.IMAGESIZE_MEDIUM);
imageSearch.setSearchCompleteCallback(this, function(){ if
(imageSearch.results && imageSearch.results.length > 0) {var
contentDiv = document.getElementById('TOYOTA'); contentDiv.innerHTML
= ''; var results = imageSearch.results; for (var i = 0; i <
results.length; i++) { var result = results; var imgContainer =
document.createElement('div'); var title = document.createElement
('div'); var newImg = document.createElement('img'); newImg.src =
result.tbUrl; var titleLink=document.createElement('a');
title.className=titleLink.className='gs-title'; titleLink.setAttribute
('href',result.url); titleLink.appendChild(document.createTextNode
(result.titleNoFormatting)); title.appendChild(titleLink);
imgContainer.appendChild(title); imgContainer.appendChild(newImg);
contentDiv.appendChild(imgContainer); } function (imageSearch)
{ var cursor = imageSearch.cursor; var curPage =
cursor.currentPageIndex; var pagesDiv = document.createElement('div');
for (var i = 0; i < cursor.pages.length; i++) { var page =
cursor.pages; if (curPage == i) { var label =
document.createTextNode(' ' + page.label + ' '); pagesDiv.appendChild
(label);} else {var link = document.createElement('a');link.href =
'javascript:imageSearch.gotoPage('+i+');';link.innerHTML =
page.label; link.style.marginRight = '2px';pagesDiv.appendChild
(link);}} var contentDiv = document.getElementById('TOYOTA');
contentDiv.appendChild(pagesDiv);} }}, null); imageSearch.execute
("TOYOTA");} google.setOnLoadCallback(OnLoadSneha);</script>
<script type="text/javascript" src="key=ABQIAAAA1XbMiDxx_BTCY2_FkPh06RRaGTYH6UMl8mADNa0YKuWNNa8VNxQEerTAUcfkyrr 6OwBovxn7TDAH5Q"></
script><div id="TOYOTA">Loading...</div><script type="text/
javascript">google.load('search', '1');var imageSearch;function
OnLoadSneha() { imageSearch = new google.search.ImageSearch();
imageSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);
imageSearch.setRestriction
(google.search.ImageSearch.RESTRICT_IMAGESIZE,
google.search.ImageSearch.IMAGESIZE_MEDIUM);
imageSearch.setSearchCompleteCallback(this, function(){ if
(imageSearch.results && imageSearch.results.length > 0) {var
contentDiv = document.getElementById('TOYOTA'); contentDiv.innerHTML
= ''; var results = imageSearch.results; for (var i = 0; i <
results.length; i++) { var result = results; var imgContainer =
document.createElement('div'); var title = document.createElement
('div'); var newImg = document.createElement('img'); newImg.src =
result.tbUrl; var titleLink=document.createElement('a');
title.className=titleLink.className='gs-title'; titleLink.setAttribute
('href',result.url); titleLink.appendChild(document.createTextNode
(result.titleNoFormatting)); title.appendChild(titleLink);
imgContainer.appendChild(title); imgContainer.appendChild(newImg);
contentDiv.appendChild(imgContainer); } function (imageSearch)
{ var cursor = imageSearch.cursor; var curPage =
cursor.currentPageIndex; var pagesDiv = document.createElement('div');
for (var i = 0; i < cursor.pages.length; i++) { var page =
cursor.pages; if (curPage == i) { var label =
document.createTextNode(' ' + page.label + ' '); pagesDiv.appendChild
(label);} else {var link = document.createElement('a');link.href =
'javascript:imageSearch.gotoPage('+i+');';link.innerHTML =
page.label; link.style.marginRight = '2px';pagesDiv.appendChild
(link);}} var contentDiv = document.getElementById('TOYOTA');
contentDiv.appendChild(pagesDiv);} }}, null); imageSearch.execute
("TOYOTA");} google.setOnLoadCallback(OnLoadSneha);</script>
for one of my blog posts about cars, I want to embed the below codes
one for BMW and one for Toyota in the blog post, individually if I
place one of these codes they work fine but if I want to place them
both together in 2 different blocks separately it doesn't work. Is
there a way to achieve this, basically giving 2 different handlers.
This will help me a lot - TIA.
<script type="text/javascript" src="key=ABQIAAAA1XbMiDxx_BTCY2_FkPh06RRaGTYH6UMl8mADNa0YKuWNNa8VNxQEerTAUcfkyrr 6OwBovxn7TDAH5Q"></
script><div id="TOYOTA">Loading...</div><script type="text/
javascript">google.load('search', '1');var imageSearch;function
OnLoadSneha() { imageSearch = new google.search.ImageSearch();
imageSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);
imageSearch.setRestriction
(google.search.ImageSearch.RESTRICT_IMAGESIZE,
google.search.ImageSearch.IMAGESIZE_MEDIUM);
imageSearch.setSearchCompleteCallback(this, function(){ if
(imageSearch.results && imageSearch.results.length > 0) {var
contentDiv = document.getElementById('TOYOTA'); contentDiv.innerHTML
= ''; var results = imageSearch.results; for (var i = 0; i <
results.length; i++) { var result = results; var imgContainer =
document.createElement('div'); var title = document.createElement
('div'); var newImg = document.createElement('img'); newImg.src =
result.tbUrl; var titleLink=document.createElement('a');
title.className=titleLink.className='gs-title'; titleLink.setAttribute
('href',result.url); titleLink.appendChild(document.createTextNode
(result.titleNoFormatting)); title.appendChild(titleLink);
imgContainer.appendChild(title); imgContainer.appendChild(newImg);
contentDiv.appendChild(imgContainer); } function (imageSearch)
{ var cursor = imageSearch.cursor; var curPage =
cursor.currentPageIndex; var pagesDiv = document.createElement('div');
for (var i = 0; i < cursor.pages.length; i++) { var page =
cursor.pages; if (curPage == i) { var label =
document.createTextNode(' ' + page.label + ' '); pagesDiv.appendChild
(label);} else {var link = document.createElement('a');link.href =
'javascript:imageSearch.gotoPage('+i+');';link.innerHTML =
page.label; link.style.marginRight = '2px';pagesDiv.appendChild
(link);}} var contentDiv = document.getElementById('TOYOTA');
contentDiv.appendChild(pagesDiv);} }}, null); imageSearch.execute
("TOYOTA");} google.setOnLoadCallback(OnLoadSneha);</script>
<script type="text/javascript" src="key=ABQIAAAA1XbMiDxx_BTCY2_FkPh06RRaGTYH6UMl8mADNa0YKuWNNa8VNxQEerTAUcfkyrr 6OwBovxn7TDAH5Q"></
script><div id="TOYOTA">Loading...</div><script type="text/
javascript">google.load('search', '1');var imageSearch;function
OnLoadSneha() { imageSearch = new google.search.ImageSearch();
imageSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);
imageSearch.setRestriction
(google.search.ImageSearch.RESTRICT_IMAGESIZE,
google.search.ImageSearch.IMAGESIZE_MEDIUM);
imageSearch.setSearchCompleteCallback(this, function(){ if
(imageSearch.results && imageSearch.results.length > 0) {var
contentDiv = document.getElementById('TOYOTA'); contentDiv.innerHTML
= ''; var results = imageSearch.results; for (var i = 0; i <
results.length; i++) { var result = results; var imgContainer =
document.createElement('div'); var title = document.createElement
('div'); var newImg = document.createElement('img'); newImg.src =
result.tbUrl; var titleLink=document.createElement('a');
title.className=titleLink.className='gs-title'; titleLink.setAttribute
('href',result.url); titleLink.appendChild(document.createTextNode
(result.titleNoFormatting)); title.appendChild(titleLink);
imgContainer.appendChild(title); imgContainer.appendChild(newImg);
contentDiv.appendChild(imgContainer); } function (imageSearch)
{ var cursor = imageSearch.cursor; var curPage =
cursor.currentPageIndex; var pagesDiv = document.createElement('div');
for (var i = 0; i < cursor.pages.length; i++) { var page =
cursor.pages; if (curPage == i) { var label =
document.createTextNode(' ' + page.label + ' '); pagesDiv.appendChild
(label);} else {var link = document.createElement('a');link.href =
'javascript:imageSearch.gotoPage('+i+');';link.innerHTML =
page.label; link.style.marginRight = '2px';pagesDiv.appendChild
(link);}} var contentDiv = document.getElementById('TOYOTA');
contentDiv.appendChild(pagesDiv);} }}, null); imageSearch.execute
("TOYOTA");} google.setOnLoadCallback(OnLoadSneha);</script>