带有自定义搜索框和按钮的Google自定义搜索?
我正在尝试进行Google自定义搜索(我只需要在我的站点上使用某种搜索引擎),并且我需要进行搜索,以便可以使用自己的搜索框(输入字段).我需要它的确切大小.我还需要能够创建自己的按钮进行搜索.我将需要能够更改搜索按钮的大小和背景.我还不确定,但实际上我可能需要将其作为常规img.
I am trying to make a Google custom search (I just need some sort of search engine on my site), and I need to make it so that I can use my own search box (input field). I need it to be of exact size. I also need to be able to make my own button to search. I am going to need to be able to change the size and background of the search button. I am not completely sure yet, but I might actually need it to be a regular img.
有人知道该怎么做吗?
如果您无法通过Google做到这一点,您知道另一种方法吗?
If you cannot do this with Google, do you know of another way to do it?
如果除了使用您自己的搜索引擎之外别无其他方法,请给我一个非常简单的教程的链接,该教程介绍了如何制作自己的搜索引擎.我愿意花更多的功夫去学习,但是我尝试了一下,在看了三个不同的教程之后,我放弃了,因为它们很长而且令人困惑.我希望我只是在错误的地方寻找.
If there is no other way besides using your own search engine, can I please get a link to a very simplified tutorial on how to make my own. I am willing to put in the extra work to learn, but I tried a bit, and after looking at three different tuts, I gave up because they were very very long and confusing. I hope I was just looking in the wrong places.
这里是我正在使用的一种,您只需要在搜索框<input id='q'
中添加一些样式,而< input value='MyButton'
是按钮点击
Here is the one I am using, you just need to add some styles to <input id='q'
which is the search box, and <input value='MyButton'
is the button to click
<!-- Google CSE Search Box Begins -->
<center>
<form id="searchbox_XXXXXXXXXX:YYYYYYYYY" action="http://myblog">
<input value="XXXXXXXXXX:YYYYYYYYY" name="cx" type="hidden"/>
<input value="FORID:11" name="cof" type="hidden"/>
<input id="q" style="width:600px;" name="q" size="75" type="text"/>
<input value="MyButton" name="sa" type="submit"/>
</form>
</center>
....
编辑:上面是我2010年的回答,我无法确定它是否正常运行,但是这里是一个正常的工作.
Edit: Above is my answer from 2010, I cannot confirm it is working or not anymore, but here is the one working.
<div id="cse" style="width: 100%;">Loading</div>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load('search', '1', {language : 'en'});
google.setOnLoadCallback(function() {
var customSearchControl = new google.search.CustomSearchControl('XXXXXXXXXXXXXXXX:YYYYYYYYYYYYYY');
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
var options = new google.search.DrawOptions();
options.setAutoComplete(true);
customSearchControl.draw('cse', options);
}, true);
</script>
有关更多信息:请参考 https://developers.google. com/custom-search/docs/js/cselement-devguide
For more info: refer to https://developers.google.com/custom-search/docs/js/cselement-devguide