简体   繁体   English

以 HTML 格式提交表单时收到错误

[英]Receiving error while submitting forms in HTML

I am working on a clone of Google's search page.我正在研究 Google 搜索页面的克隆。 I want the page to show search results in Google when the user uses it.我希望页面在用户使用时在 Google 中显示搜索结果。 But instead of taking the user to a search result page, the program is instead just putting the link after my page's link.但是,该程序并没有将用户带到搜索结果页面,而是只是将链接放在我页面的链接之后。 I think I must have messed some somewhere in the code but can't figure out where.我想我一定是在代码的某个地方搞砸了,但不知道在哪里。 I'm just starting to learn HTML.我刚刚开始学习 HTML。 Please help me through this.请帮我解决这个问题。 Thanks!谢谢!

Screenshot of error错误截图

Here is my index.html:这是我的 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>

In <form action="www.google.com/search" id="search"> , the action links to a place within your directory.<form action="www.google.com/search" id="search"> ,操作链接到您目录中的某个位置。 To link to outside URLs, you need to use the http prefix.要链接到外部 URL,您需要使用 http 前缀。

<form action="https://www.google.com/search" id="search"> fixes the issue. <form action="https://www.google.com/search" id="search">修复了该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM