按指定尺寸搜索图像

时间:2019-10-26 16:23:45

标签: html image search google-image-search

我前段时间得到了一些帮助,可以进行某种搜索来在Google上以预设大小搜索图像。现在,我想知道是否可以更改此HTML5,以便您可以键入自己的尺寸来使用而不是预设尺寸。因此,如果我在标有 width 的文本框中键入 54 ,在标有 height 的文本框中键入 10 ,我只会得到宽度 54 ,高度 10 的图片。

<form action="https://www.google.com/search" method="get">
   <input name="tbm" value="isch" type="hidden">
   <input name="tbs" value="isz:ex,iszw:10328,iszh:7760" type="hidden">
   <input name="q" size="35" type="text" placeholder="zelda">
   <input type="submit" value="Find 10K images">
 </form>

1 个答案:

答案 0 :(得分:0)

<script>
    function addSpecs() {
        document.getElementsByName("tbs")[0].value =
            "isz:ex,iszw:"
            + document.getElementById("w").value
            + ",iszh:"
            + document.getElementById("h").value;
    }
</script>
<form action="//www.google.com/search" method="get">
    <input type="hidden" name="tbm" value="isch" />
    <input type="hidden" name="tbs" value="" />
    w: <input type="text" id="w" /><br />
    h: <input type="text" id="h" /><br />
    <input type="text" name="q" size="35" /><br />
    <input type="submit" value="Find images" onclick="addSpecs();" />
 </form>
相关问题