View Full Version : Adding Internal Site Search

09-22-2011, 05:20 PM
I'm trying to add an internal site search to my website, and it only work for some search items, not for everything. For example, if I search for Bud Light, Budweiser, Bud Light Lime, it finds them. But if I search for Stella Artois, Paulaner, or Hoegaarden, it doesn't find anything. I'm thinking there's something wrong with the javascript code, I'm just not sure how to fix it. I really appreciate any help with this!!!

Here's the code in the head region:

[<script type="text/javascript">

// Google Internal Site Search script- By JavaScriptKit.com (http://www.javascriptkit.com)

// For this and over 400+ free scripts, visit JavaScript Kit- http://www.javascriptkit.com/
// This notice must stay intact for use
//Enter domain of site to search.
var domainroot="www.mhdbud.com"
function Gsitesearch(curobj){
curobj.q.value="www.mhdbud.com:"+domainroot+" "+curobj.qfront.value


Here's what I've got in the body:

[<form action="http://www.google.com/search" method="get" onSubmit="Gsitesearch(this)">

<input name="q" type="hidden" />
<input name="qfront" type="text" style="width: 180px" /> <input type="submit" value="Search" />

You can try the site search to see what I'm talking about on this webpage:

09-23-2011, 06:32 PM
I checked out your site and it looks like it could be an SEO issue. It's possible that they didn't index the whole page. You may want to add some SEO meta tags, etc., to make sure it's all indexed. Also, that script you found seems old. The format for searching a domain on google is like this:

Paulaner site:mhdbud.com

so the string it sends should be like this:

curobj.q.value=curobj.qfront.value+' site:'+domainroot