用js在新窗口中打开搜索表单



我想更改下面的代码,以便它在一个新窗口中打开。尝试使用"窗口。打开"而不是"window.location "。Href "运气不好。

<form method="get" action="http://www.somesite.com/test/" onSubmit="return false;">
<input type="search" name="q" value="" />
<input type="submit" onClick="window.location.href=this.form.action + this.form.q.value;" />
</form>
<form method="get" action="http://www.somesite.com/test/" onSubmit="return false;">
<input type="search" name="q" value="" />
<input type="submit" onClick="window.open(this.form.action + this.form.q.value); "/>
</form>

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

我不知道你需要哪一个。

最新更新