Not sure I understand. This is exactly what I have. The problem is, I
need to remove the form tag for the index page and do something
similar to what you explained. Could you help me out:

Index:
---------------------
<script type="text/javascript">
      function inputFocus() {
        document.getElementById('query-input').style['background'] =
'';
      }

      function inputBlur() {
        var queryInput = document.getElementById('query-input');
        if (!queryInput.value) {
          queryInput.style['background'] = 'white url(http://
www.google.com/coop/images/google_custom_search_watermark.gif) no-
repeat 0% 50%';
        }
      }
</script>

<form action="/html/two_page_search_results.html" method="GET">
    <input name="q" size="25" id="query-input" onfocus="inputFocus();"
onblur="inputBlur();" />
    <button type="submit">Search</button>
 </form>

Result:
-----------------------

<script src="http://www.google.com/jsapi"; type="text/javascript"></
script>

    <script type="text/javascript">
      google.load('search', '1');

      /**
       * Extracts the users query from the URL.
       */
      function getQuery() {
        var url = '' + window.location;
        var queryStart = url.indexOf('?') + 1;
        if (queryStart > 0) {
          var parts = url.substr(queryStart).split('&');
          for (var i = 0; i < parts.length; i++) {
            if (parts[i].substr(0, 1) == 'q') {
              return decodeURIComponent(
                  parts[i].split('=')[1].replace(/\+/g, ' '));
            }
          }
        }
        return '';
      }

      function onLoad() {
        // Create a custom search control that uses a CSE restricted
to
        // code.google.com
        var customSearchControl = new
google.search.CustomSearchControl(
            '012157912978810372049:-cv6ao3zqua');

        // Draw the control in content div
        customSearchControl.draw('results');

        // Run a query
        customSearchControl.execute(getQuery());
      }

      google.setOnLoadCallback(onLoad);
    </script>

<div id="results">Loading...</div>

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