强制谷歌图片搜索 [英] Force google image search

查看:64
本文介绍了强制谷歌图片搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的网站,其中的主要内容是带有两个导航列表的导航选项卡:Web和图像.在导航选项卡下,我有一个Google自定义搜索搜索元素/栏.默认情况下,"Web"选项卡被选择为"Web".

I have a simple site where the top content is a navigation tab with two navigation lists: Web and Image. Under the navigation tab i have a google custom search search element/bar. The web tab is by default selected to web.

默认情况下,谷歌自定义搜索将搜索网络,有什么方法可以迫使它通过php或可选的javascript搜索图像.因此,在导航菜单中设置图片标签后,它将搜索Google图片而不是网络吗?

By default the google custom search will search for the web, is there any way i can force it to search for images by php or optionally javascript. So when the images tab is set in the navigation menu it will search the google images instead the web ?

推荐答案

我认为您基本上可以创建自己的Google图片搜索表单.要知道的最重要的是,图像搜索的URL如下所示:

I think you can basically create your own Google Image search form. The most important thing to know is that the URL for image search looks like:

http://www.google.com/search?site=imghp&tbm=isch&q=Glee

(其中欢乐合唱团"是您的搜索词).

(Where "Glee" is your search term).

这是HTML格式的简单示例:

Here's a simple example of how the form would be, HTML:

<h1>Google Image Search</h1>
<input type = "text" id = "srchterm"/>
<button type = "button" onclick = "reDirect();">Search!</button>

JavaScript:

JavaScript:

function reDirect() {
    window.location = 'http://www.google.com/search?site=imghp&tbm=isch&q=' + document.getElementById('srchterm').value;
}

希望对您有任何帮助!

这篇关于强制谷歌图片搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆