【问题标题】:Receiving error while submitting forms in HTML在 HTML 中提交表单时收到错误
【发布时间】:2021-02-09 17:55:32
【问题描述】:

我正在开发 Google 搜索页面的克隆。我希望该页面在用户使用它时在 Google 中显示搜索结果。但是,该程序并没有将用户带到搜索结果页面,而是将链接放在我的页面链接之后。我想我一定是在代码的某个地方弄乱了一些东西,但不知道在哪里。我刚开始学习HTML。请帮我解决这个问题。谢谢!

Screenshot of error

这是我的 index.html:

<html>
  <head>
    <title>Google Search</title>
    <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://maxcdn.icons8.com/fonts/line-awesome/1.1/css/line-awesome-font-awesome.min.css">
    <link rel="stylesheet" href="css/custom.css">
  </head>
  <body>
    <div class="top-bar">
      <div class="bar-right">
        <div class="menu">
          <a href="image.html">Image Search</a>
          <a href="advanced.html">Advanced Search</a>
        </div>
        <a href="" class="profile-trigger">
          <img src="images/profile.png">
        </a>
      </div>
    </div>
    <form action="www.google.com/search" id="search">
      <div class="content">
        <div class="search-wrapper">
          <a href="" class="search-logo">
            <img src="images/google-logo.png">
          </a>
          <div class="search-bar">
            <div class="search-icon">
              <i class="fa fa-search"></i>
            </div>
            <input type="text" name="q">
          </div>
          <div class="search-buttons">
            <input type="submit" value="Google Search"></a>
            <a href="">I'm Feeling Lucky</a>
          </div>
        </div>
      </div>
    </form>
  </body>
</html>

【问题讨论】:

    标签: html forms input hyperlink google-search


    【解决方案1】:

    &lt;form action="www.google.com/search" id="search"&gt; 中,该操作链接到您目录中的某个位置。要链接到外部 URL,您需要使用 http 前缀。

    &lt;form action="https://www.google.com/search" id="search"&gt; 解决了这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-08-30
      • 2020-02-04
      • 2019-10-09
      • 2013-01-04
      • 2021-07-13
      • 2021-09-17
      • 2015-04-20
      相关资源
      最近更新 更多