如何在Google搜索中使用过滤器?

发布于 2024-09-15 06:35:03 字数 825 浏览 0 评论 0原文

我已使用以下方法将文本框搜索转换为 Google 搜索:

location.href = "http://images.google.com/search?q=" + val;

但是,我想要 Web 搜索、图像搜索、本地搜索和搜索选项。新闻搜索。

我确实有:

<tr height="40">
<td width="80%" align="center" ><input id="searchText" type="text" size="100"/></td>
<td class="searchbox" width="20%" align="center"><a href="#" onclick="startSearch()">Search</a></td>
<td width="0%"></td>
</tr>

<td align="center">
<input type="radio" name="searchType" value="true"/> Web
<input type="radio" name="searchType" value="false"/> Image
<input type="radio" name="searchType" value="false"/> News
<input type="radio" name="searchType" value="false"/> Local
</td>

如何使用上面相同的链接过滤此选项。

I have converted a textbox search to Google Search using :

location.href = "http://images.google.com/search?q=" + val;

But, I want options of Web Search, Image Search, Local Search & News Search.

I do have :

<tr height="40">
<td width="80%" align="center" ><input id="searchText" type="text" size="100"/></td>
<td class="searchbox" width="20%" align="center"><a href="#" onclick="startSearch()">Search</a></td>
<td width="0%"></td>
</tr>

<td align="center">
<input type="radio" name="searchType" value="true"/> Web
<input type="radio" name="searchType" value="false"/> Image
<input type="radio" name="searchType" value="false"/> News
<input type="radio" name="searchType" value="false"/> Local
</td>

How do I filter this optiong using the same above link.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

终陌 2024-09-22 06:35:03

首先,您确实应该考虑使用 Google Search API,它会给你更多的力量和控制力。

但如果您需要一些快速而肮脏的东西,您可能需要在连接查询之前选择 URL。以下是 url:

"http://www.google.com/maps?q=" + val;
"http://www.google.com/images?q=" + val;
"http://www.google.com/news?q=" + val;

等。

因此,也许要做的事情是维护一个包含当前搜索 URL 的全局变量,然后在每个单选按钮的 onclick 函数中更改该变量。

First of all, you really should look into using the Google Search API, which will give you a lot more power and control.

But if you need something quick and dirty, you would want to select the URL before concatenating the query. Here are the urls:

"http://www.google.com/maps?q=" + val;
"http://www.google.com/images?q=" + val;
"http://www.google.com/news?q=" + val;

etc.

So perhaps the thing to do is maintain a global variable that contains the current search URL, and then change that variable in an onclick function for each radio button.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文