在新窗口中打开搜索结果

时间:2015-09-26 16:20:04

标签: javascript php html

如何在新窗口中打开搜索结果。这段代码有什么问题。 它会打开新选项卡但不会处理结果

<form action="hhtp://google.com/search" method = "get" target="_blank">
<input type ="text" name="q"/>

<input type ="submit" value = "search>
</form>

1 个答案:

答案 0 :(得分:1)

您的action属性中有拼写错误(hhtp而不是http)

<强>答案: 感谢您在评论中@zws's JSFiddle得到答案。

<form action="http://google.com/search" method="get" target="_blank">
  <input type="text" name="q">
  <input type="submit" value="search">
</form>

编辑1: 如果要执行Web搜索,建议使用 Google's custom search API

编辑2: 您可能会想到使用AJAX对Google的搜索表单/页面执行POST或GET,但由于CSRF(Cross Site Request Forgery

而无法使用