如何在我的网站上制作我的搜索引擎,特定于网站

时间:2015-12-21 17:54:26

标签: html search searchbar

我已经有了这段代码:

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

这个.js文件

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;

我正在努力使这个网站具体...感谢您的帮助到目前为止,对此有任何想法?

1 个答案:

答案 0 :(得分:1)

谢谢你们。能够添加onclick =&#34; doSearch(this.form.query);&#34; /&gt;和一个带

的js文件
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;
它现在像一角硬币。我只需找到一种方法来搜索我自己的网站。