如何在新窗口中打开搜索结果。这段代码有什么问题。 它打开了新的选项卡,但不处理结果在新窗口中打开搜索结果
<form action="hhtp://google.com/search" method = "get" target="_blank">
<input type ="text" name="q"/>
<input type ="submit" value = "search>
</form>
如何在新窗口中打开搜索结果。这段代码有什么问题。 它打开了新的选项卡,但不处理结果在新窗口中打开搜索结果
<form action="hhtp://google.com/search" method = "get" target="_blank">
<input type ="text" name="q"/>
<input type ="submit" value = "search>
</form>
有一个错字在你的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: 如果要执行网络搜索,建议使用 Google's custom search API
编辑2: 你可能会得到的想法,使用AJAX来执行POST或GET到谷歌的搜索表单/页面,但这不会因为CSRF(Cross Site Request Forgery)
那么什么是正确的代码? – User112232010
@AliUppal不幸的是,我不是这方面的专家,但我已经通过指向Google搜索API的链接更新了答案。 – grim
感谢您的帮助:) – User112232010
无法正常工作您为什么要将GET发送到谷歌?或者,谷歌只是一个占位符? – Zsw
为什么星星周围有星星?另外 - 你在你的url中指定了hhtp而不是http,并且你的=标志附近有很多额外的空格。我认为谷歌可能希望你使用https;也可能是一篇文章,而不是一个get,但如果你看他们的搜索页面的来源,你可能会发现。 – Fiid