【问题标题】:Have Google Search On Website? [duplicate]网站上有谷歌搜索吗? [复制]
【发布时间】:2013-06-04 10:55:35
【问题描述】:
当我说 Google 搜索时,我并不是指仅用于我的网站的搜索栏,我希望它有一个搜索栏,如果他们在其中写了一些东西,它会在 Google 上搜索吗?
类似这样的:
<form method="get" action="http://www.google.com/search">
我会为此只使用 css 和 html 吗?或者我可以使用 JavaScript 或其他东西让它变得更好而不那么简单吗?
【问题讨论】:
标签:
javascript
html
css
search
【解决方案1】:
在 Google 中键入 google 自定义搜索。它包含在您的网站中嵌入 Google 搜索的所有步骤:)
【解决方案2】:
这应该可行:
<form name="cse" id="searchbox_demo" action="http://www.google.com/cse">
<input type="hidden" name="cref" value="" />
<input type="hidden" name="ie" value="utf-8" />
<input type="hidden" name="hl" value="" />
<input name="q" type="text" size="40" />
<input type="submit" name="sa" value="Search" />
</form>
<script type="text/javascript" src="http://www.google.com/cse/tools/onthefly?form=searchbox_demo&lang="></script>