Remco
Remco

Reputation: 357

How do I make my search engine on my site, site specific

I have already got this code:

                    <div id="search">
                        <form action="http://www.google.com/search?site:www.hostelguy.com" method="get">
                            <input type="text" class="field" name="query" value="Search..." title="Search..." />
                            <input type="submit" value="" alt="" class="submit-button" title="Search" onclick="doSearch(this.form.query);"/>


                        </form>

And this .js file

function doSearch ( s ) {
openDbRelativeURL("All?SearchView&Query=" + s.value);
}

function openDbRelativeURL( url, target ){
//Check we have a target window;
target = (target == null ) ? window : target;
//Work out the path of the database;
path = location.pathname.split('.nsf')[0] + '.nsf/';
target.location.href = path + url;

and i am trying to make this site specific... Thanks for your help so far, any ideas on this?

Upvotes: 0

Views: 66

Answers (1)

Remco
Remco

Reputation: 357

Thanks guys. Was able to add onclick="doSearch(this.form.query);"/> and a js file with

function doSearch ( s ) {
openDbRelativeURL("All?SearchView&Query=" + s.value);
}

function openDbRelativeURL( url, target ){
//Check we have a target window;
target = (target == null ) ? window : target;
//Work out the path of the database;
path = location.pathname.split('.nsf')[0] + '.nsf/';
target.location.href = path + url;

it now works like a dime. I just have to find a way to search my own site.

Upvotes: 1

Related Questions