0

我已设法使用 window.location.href 向 Google 发送查询,但我不知道如何提交 Google 搜索表单以便查看结果。

这是我的 javascript 代码,它使用在搜索框中输入的查询将窗口发送到 Google,但是如何提交 Google 的表单?

var query = "hello";
var firstPart = "http://google.com/?q=";
window.location.href = firstPart + query;
4

1 回答 1

1

如果您使用此 URL:“ http://google.com/search?q= ”,则无需提交,在您的代码中为:

var query = "hello";
var firstPart = "http://google.com/search?q=";
window.location.href = firstPart + query;
于 2013-03-29T18:02:45.817 回答