1

ここに私が開発しているサイトのリンクがあります

http://ashteldemo.com/leonardpatel/

ページの右上にある Google カスタム検索ボックスを使用しました

誰かがクエリを書いてEnterキーを押すと、別のページまたは別のタブに結果が表示されるはずですが、同じページまたは同じタブに結果が表示されています

ここにグーグルが提供するコードがあります:

<script>
(function() {
var cx = '006011017794504203273:7s66ki24jds';
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:searchbox-only></gcse:searchbox-only>

検索結果を別のタブに表示したい、または

4

1 に答える 1

2

HTML を使用して Google 検索フォームを挿入し、送信ボタンにターゲットを設定してみてください。

例えば、

<form id="cse-search-box" action="http://google.com/cse">
<input type="hidden" name="cx" value="YOUR SEARCH ENGINE ID goes here" />
<input type="hidden" name="ie" value="UTF-8" />
<input type="text" name="q" size="31" />
<input type="submit" name="sa" target="_blank" value="Search" />
</form>
<img src="http://www.google.com/cse/images/google_custom_search_smwide.gif">

https://support.google.com/customsearch/answer/1351747?hl=ja

于 2013-10-10T12:01:12.767 に答える