<分区>
标签 javascript html css search
<分区>
当我说 Google 搜索时,我并不是指仅针对我的网站的搜索栏,我希望它有一个搜索栏,如果他们在其中写了一些东西,它会在 Google 上搜索吗?
像这样:
<form method="get" action="http://www.google.com/search">
我会为此只使用 css 和 html 吗?或者我可以使用 JavaScript 或其他东西使它变得更好和更简单吗?
最佳答案
这应该有效:
<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>
关于javascript - 网站上有谷歌搜索吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16995868/