Hi there,

I am fairly new to Google Ajax APIs and in fact relatively new to AJAX
anyway.

I am learning by simply practicing on one of my sites and am trying to
come up with code that will do a simple restricted site search and
then put the results on a different part of the page.

Basically trying to combine the Set Site Restrict and the Search
Result Placement code examples.

Despite spending way too many hours trying to figure it out, I have
got stuck and am hoping for a steer please. I can place the search bow
where I want and place the results where I want but for some reason I
have not been able get it to restrict it to a single site.


Here is my current code and any help would be vvery gratefully
received please....

 google.load('search', '1');
    function OnLoad() {
      // Create a search control
      var searchControl = new google.search.SearchControl();

          // Add in a WebSearch
      var webSearch = new google.search.WebSearch();

          // Restrict our search to pages from the Pack a Mail
      webSearch.setSiteRestriction('www.packamail.co.uk');

          // web search, open, alternate root
      var options = new google.search.SearcherOptions();
      options.setExpandMode
(google.search.SearchControl.EXPAND_MODE_OPEN);
      options.setRoot(document.getElementById("somewhere_else"));
          //options.setSiteRestriction('www.packamail.co.uk');
      searchControl.addSearcher(new google.search.WebSearch(),
options);

      // tell the searcher to draw itself and tell it where to attach
      searchControl.draw(document.getElementById("content"));
      // execute an inital search
      searchControl.execute('');
    }
    google.setOnLoadCallback(OnLoad);



Thank you!

Paul

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to