开发者

How to use Filter in Google Search?

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" n开发者_运维百科ame="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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜