i want to put custom search in my website...google custom search...bt if i use the code it will not show my html search box...it shows google custom search box...how to use it for my search box???

Recommended Answers

Show what you did.

Jump to Post

All 3 Replies

Show what you did.

this is custom search code..

<script>
  (function() {
    var cx = '013580470917512101672:0ssj6ajuova';
    var gcse = document.createElement('script');
    gcse.type = 'text/javascript';
    gcse.async = true;
    gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
        '//www.google.com/cse/cse.js?cx=' + cx;
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(gcse, s);
  })();
</script>
<gcse:search></gcse:search>

nd my search box code is:

<form id="form1" name="form1" method="post" action="">
    <div class="lfloat"><label for="textfield"></label>
    <input name="textfield" type="text" class="searchfield" id="textfield" onclick="this.value='';" value="Search your Keyword" /></div><div style="position:relative; float:left; left:2px; margin:4px;">
    <input type="image" src="images/search_button.png" name="button" id="button" value="Submit" style="margin:0px;" /></div>
  </form>

What I have done is create my own search entry box which (when submitted) sends the entered search term to a separate dedicated search results page which contains the google code (and included styling) e.g. "searchresults.php?q=enteredsearchtext". This initiates a custom search when the page loads.
Example: http://www.gwscsw.org/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.