Google I'm Feeling Lucky's button

[亡魂溺海] 提交于 2021-01-29 11:23:33

问题


I am new on learning HTMl coding, and I wanted to train my self by rproducing the https://www.google.com/ page. Thus, I've added inputs to let the user making is researches.

There are two different types of reshearches I want to provide (jus as like in the Google's page). In the first one, by clicking on the "Google Search" submit input, the user is doing a classic research. While in the second one, when the user clicks on the "I'm Feeling Lucky" submit input, the user is directly taken to the first link that would have appeared if the ser would have done a classic research.

But the problem is that both of the two submit inputs are giving me a "classic research"and after looking for many answers in this forum, and also other ones, I still don't understand why does my html code doesn't work:

<!DOCTYPE html>
<html lang="en">

    <head>
        <title>Google</title>
        <link rel="stylesheet" href="style.css">
        <link rel="shortcut icon" type="image/x-icon" href="google_logo.png">
    </head>
    <body>
        <div class="ends">
            <a id="left" href="ggimage.html">Google image</a>
            <a id="right" href="ggladvanced_search.html">Google advanced search</a>
        </div>
        <br><br><br><br><br><br><br><br>
        <div>
            <img src="google_search.PNG" alt="Google Search">
            <form action="https://google.com/search">
                <input type="text" name="q" placeholder="Enter your research">
                <div>    
                    <input id="right" name="btnK" type="submit" value="Google Search">
                    <p style="width: 10px;"></p>
                    <input id="left" name="btnI" type="submit" value="I'm Feeling Lucky"> 
                </div>
            </form>
        </div>
    </body>
</html>

I tried to use buttons instead of submit inputs, but it is showing the same results.


回答1:


The problem is that you left your <input type="text"...> tag open. Close it and your form should work as expected.

Change this: <input type="text" name="q" placeholder="Enter your reshearch">

to this: <input type="text" name="q" placeholder="Enter your research"/>



来源:https://stackoverflow.com/questions/64506270/google-im-feeling-luckys-button

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!