首页 > 解决方案 > 自定义 Google 搜索(不是 Google 自定义搜索)

问题描述

有人可以向我解释一下这个 HTML 是如何工作的吗?我想做一些可以执行此搜索的东西: https://www.google.com/search?q=%25s&client=firefox-b-1-d&biw=1366&bih=614&tbm=isch&source=lnt&tbs=isz:ex,iszw:7680,iszh:4320

我使用 Inspect Element 从InternetTIPS.com获取此 HTML :

<div><form action="https://www.google.com/search" method="get" name="{5C088896-C4CC-4430-A6D8-9DC9D2BE379D}" target="_top"><input maxlength="255" name="q" size="35" type="text"><input name="Overview" type="hidden" value="1"><input name="internettips" type="submit" value="Find Flash Files"><input name="as_filetype" type="hidden" value="swf"></form></div>

在此处查看 HTML 功能的演示。先感谢您。

标签: htmlformssearch

解决方案


将搜索表单添加到在 Google 中搜索特定大小的图像的页面中,您只需使用以下 HTML:

<!-- This is a search form that will take us to
     https://www.google.com/search?tbm=isch&tbs=isz:ex,iszw:7680,iszh:4320&q=example
     when we search for . This search will show us only images, and
     those images will all be 7680 pixels wide and 4320 pixels tall.

     First we enclose everything in a <> whose  is everything that
     the search engine results page’s URI to the left of the question mark (?)
     in it -->
<form action="https://www.google.com/search" method="get">

   <!-- Next, we add the arguments that are added to the Google URI. For each
        part of the URI we want to build, we need an <> element with a
         attribute. -->

   <!-- build = -->
   <!--  needs to be set to , which tells Google we want only
        image search results. We add ="" to the input element
        because we don’t want the end user to have to choose that
        themself -->
   <input name="tbm" value="isch" type="hidden">

   <!-- build =:,:,: -->
   <!--  needs to be set to a three-part parameter that tells Google
        we’re doing a search for images of a certain size and what the
        dimensions we’re looking for are -->
   <input name="tbs" value="isz:ex,iszw:7680,iszh:4320" type="hidden">

   <!-- build = (but ours won’t specify "example" — the user
        will decide what to search for). This parameter’s  is
        not  but rather , which is what we’ll ask the user to
        enter. -->
   <!-- If we don’t want to prompt our users’ imaginations,
        we could remove ="" -->
   <!-- ="" means that the field where the user will input their
        query is about 35 characters wide on page load -->
   <input name="q" size="35" type="text" placeholder="puppies">

   <!-- Finally, we add the button the user can tap to enter their query,
        so our  is . We can set our value to whatever we want
        our button to say -->
   <input type="submit" value="Find images of size 7680px × 4320px">

 <!-- <> is the only element we have used that we must close -->
 </form>

推荐阅读