Thanks very much for your help Jeremy. I am going to look for some examples of incorporating the api with forms.
Initially my code was a custom search engine using a form. I thought that I would try out the api for more functionality. I am not too sure if the api and a form are feasible and that I should stick with the simple CSE. But i would rather use the API so if you know any good examples please let me know. Thanks again for your time. On Sep 4, 4:50 pm, Jeremy Geerdes <[email protected]> wrote: > Oh! I see what you're saying! I was misunderstanding what you were > looking for. You want the result list to display in a different page/ > window, rather than the links for each individual result to open in a > different window. > > The way to do this would be to build your own HTML form and set its > action to the second page. Then, on the second page, you would want to > have logic that would take the q parameter and run the search. You can > do this with Javascript by parsing the q out of the location.href > string, or you can do it server-side with PHP, Perl, etc. If you opt > for the latter, you can actually run the search server-side and then > just display the results, or you can take the q parameter and just > build your JS-based search control, passing q through to the control's > exec method. > > Jeremy R. Geerdes > Effective website design & development > Des Moines, IA > > For more information or a project > quote:http://jgeerdes.home.mchsi.comhttp://jgeerdes.blogspot.comhttp://jgeerdes.wordpress.com > [email protected] > > Unless otherwise noted, any price quotes contained within this > communication are given in US dollars. > > If you're in the Des Moines, IA, area, check out Debra Heights > Wesleyan Church! > > And check out my blog, Adventures in Web Development, > athttp://jgeerdes.blogspot.com > ! > > On Sep 4, 2009, at 9:50 AM, duxbuz wrote: > > > > > > > Hi, > > > I have no real place to show you my full code. > > > The problem being your example just shows the results. I need to see > > the search within a page that has html content, then i can see the > > results opening in a NEW page. > > > If I use the basic Hello World example I cannot see this take place as > > its all happening in a blank page. > > > In my example that i ran in Code playground, my page had html content > > (links txt etc). When I searched the results came back within my page. > > > Are you positivre this is opening a new page? Did you have an original > > page with some html content on to see it display in a NEW blank page? > > > Thanks for your time. > > > ===== Partial code ===== > > <script type="text/javascript"> > > google.load('search', '1'); > > > function OnLoad() { > > > // Create a search control > > var searchControl = new google.search.SearchControl(); > > > // Add in a full set of searchers > > var localSearch = new google.search.LocalSearch(); > > searchControl.addSearcher(localSearch); > > searchControl.addSearcher(new google.search.WebSearch()); > > searchControl.addSearcher(new google.search.VideoSearch()); > > searchControl.addSearcher(new google.search.BlogSearch()); > > searchControl.addSearcher(new google.search.NewsSearch()); > > searchControl.addSearcher(new google.search.ImageSearch()); > > searchControl.addSearcher(new google.search.BookSearch()); > > searchControl.addSearcher(new google.search.PatentSearch()); > > > // Set the Local Search center point > > localSearch.setCenterPoint("New York, NY"); > > searchControl.setLinkTarget > > (google.search.Search.LINK_TARGET_BLANK); > > > // tell the searcher to draw itself and tell it where to attach > > var drawOptions = new google.search.DrawOptions(); > > > searchControl.draw(document.getElementById("cse")); > > > // execute an inital search > > searchControl.execute("VW GTI"); > > } > > > google.setOnLoadCallback(OnLoad); > > </script> > > > <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> > > > <title>St Peter's RC School</title> > > <link rel="stylesheet" href="style.css" type="text/css" > > charset="utf-8" /> > > <script src="images/flash/AC_RunActiveContent.js" type="text/ > > javascript"></script> > > <style type="text/css"> > > <!-- > > .style1 {font-size: 12px} > > .style2 {font-size: 12px; color: #000000; } > > .style3 {color: #000000} > > --> > > </style> > > </head> > > > <body> > > <div id="wrapper"> > > <div id="header"> > > <div id="logo"><img src="images/logo.jpg" width="446" > > height="45" > > alt="Charity Trust" /></div> > > <div id="nav"> > > etc etc..... > > > On Sep 4, 3:13 pm, Jeremy Geerdes <[email protected]> wrote: > >> Here is the Hello, World example edited as I suggested. It seems to > >> work for me. > > >>http://savedbythegoog.appspot.com/? > >> id=ag5zYXZlZGJ5dGhlZ29vZ3ISCxIJU2F... > > >> If you want to play with it further, you could try the API > >> Playground: > > >>http://code.google.com/apis/ajax/playground/?exp=search > > >> Jeremy R. Geerdes > >> Effective website design & development > >> Des Moines, IA > > >> For more information or a project quote:http://jgeerdes.home.mchsi.comhttp > >> ://jgeerdes.blogspot.comhttp://jgeerdes.wordpress.com > >> [email protected] > > >> Unless otherwise noted, any price quotes contained within this > >> communication are given in US dollars. > > >> If you're in the Des Moines, IA, area, check out Debra Heights > >> Wesleyan Church! > > >> And check out my blog, Adventures in Web Development, > >> athttp://jgeerdes.blogspot.com > >> ! > > >> On Sep 4, 2009, at 8:07 AM, duxbuz wrote: > > >>> Hi, > > >>> Thanks for your response. > > >>> Unfortunately this has not made any difference. It is quite > >>> difficult > >>> to find any examples on the internet to find out why it fails to > >>> work. > > >>> Thanks for trying. > > >>> On Sep 4, 12:04 pm, Jeremy Geerdes <[email protected]> wrote: > >>>> I could be wrong, but I'm pretty sure this is because of the way > >>>> the > >>>> SearchControl is designed. Namely, when you call the control's draw > >>>> method, it will override a number of the settings that you've set > >>>> on > >>>> the individual searcher(s). Link target, I believe, is one of them. > >>>> The way to workaround this is to use the control's setLinkTarget > >>>> method instead of the searcher's. In other words, replace the line > >>>> reading like this: > > >>>> localSearch.setLinkTarget(google.search.Search.LINK_TARGET_BLANK); > > >>>> with this: > > >>>> searchControl > >>>> .setLinkTarget(google.search.Search.LINK_TARGET_BLANK); > > >>>> Jeremy R. Geerdes > >>>> Effective website design & development > >>>> Des Moines, IA > > >>>> For more information or a project > >>>> quote:http://jgeerdes.home.mchsi.comhttp > >>>> ://jgeerdes.blogspot.comhttp://jgeerdes.wordpress.com > >>>> [email protected] > > >>>> Unless otherwise noted, any price quotes contained within this > >>>> communication are given in US dollars. > > >>>> If you're in the Des Moines, IA, area, check out Debra Heights > >>>> Wesleyan Church! > > >>>> And check out my blog, Adventures in Web Development, > >>>> athttp://jgeerdes.blogspot.com > >>>> ! > > >>>> On Sep 4, 2009, at 4:54 AM, duxbuz wrote: > > >>>>> Hi > > >>>>> Am just trying to set up a basic search on webpage. > > >>>>> I have currently been using some code from HelloWorld example. > > >>>>> My issue is the line containing -- localSearch.setLinkTarget > >>>>> (google.search.Search.LINK_TARGET_BLANK); > > >>>>> it doews not seem to open results in blank window. > > >>>>> Anyone help? > > >>>>> Thanks. > > >>>>> ======== example ======== > > >>>>> google.load('search', '1'); > > >>>>> function OnLoad() { > >>>>> // Create a search control > >>>>> var searchControl = new google.search.SearchControl(); > > >>>>> // Add in a full set of searchers > >>>>> var localSearch = new google.search.LocalSearch(); > >>>>> searchControl.addSearcher(localSearch); > >>>>> searchControl.addSearcher(new google.search.WebSearch()); > >>>>> searchControl.addSearcher(new google.search.VideoSearch()); > >>>>> searchControl.addSearcher(new google.search.BlogSearch()); > >>>>> searchControl.addSearcher(new google.search.NewsSearch()); > >>>>> searchControl.addSearcher(new google.search.ImageSearch()); > >>>>> searchControl.addSearcher(new google.search.BookSearch()); > >>>>> searchControl.addSearcher(new google.search.PatentSearch()); > > >>>>> // Set the Local Search center point > >>>>> localSearch.setCenterPoint("New York, NY"); > > >>>>> // new window?? > >>>>> localSearch.setLinkTarget(google.search.Search.LINK_TARGET_BLANK); > > >>>>> // tell the searcher to draw itself and tell it where to attach > >>>>> searchControl.draw(document.getElementById("cse")); > > >>>>> // execute an inital search > >>>>> searchControl.execute("VW GTI"); > >>>>> } > > >>>>> google.setOnLoadCallback(OnLoad); > >>>>> </script>- Hide quoted text - > > >>>> - Show quoted text -- Hide quoted text - > > >> - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-ajax-search-api?hl=en -~----------~----~----~----~------~----~------~--~---
