2015-12-21 66 views
0

我已經得到這個代碼:如何讓我的搜索引擎我的網站上,具體地點

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

,我試圖使這個網站具體...感謝您的幫助到目前爲止,對此有何看法?

+0

你想做什麼? –

+0

將表單提交給Google搜索結果? –

+0

你沒有傳遞查詢字符串到谷歌,您的輸入沒有名稱 –

回答

1

謝謝你們。能夠添加的onclick = 「doSearch(this.form.query);」/>與

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; 

現在就像一角錢一個js文件。我只需要找到一種方法來搜索我自己的網站。

相關問題