html - Google 手气不错的按钮
问题描述
我是学习 HTMl 编码的新手,我想通过复制https://www.google.com/页面来训练自己。因此,我添加了输入以让用户进行研究。
我想提供两种不同类型的研究(就像在谷歌页面中一样)。在第一个中,通过点击“Google Search”提交输入,用户正在做一个经典的研究。而在第二个中,当用户点击“我感觉很幸运”提交输入时,用户会直接被带到第一个链接,如果用户进行了经典研究,该链接会出现。
但问题是,这两个提交输入都给了我一个“经典研究”,在这个论坛和其他论坛中寻找了很多答案之后,我仍然不明白为什么我的 html 代码不起作用:
<!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>
我尝试使用按钮而不是提交输入,但它显示了相同的结果。
解决方案
问题是您让<input type="text"...>
标签处于打开状态。关闭它,您的表单应该按预期工作。
改变这个:
<input type="text" name="q" placeholder="Enter your reshearch">
对此:
<input type="text" name="q" placeholder="Enter your research"/>
推荐阅读
- python - Python 合并没有空白新行的行
- ios - 我无法在 swift iOS 中使用 NotificationCenter 在控制台中获得任何输出
- c - 尝试创建一个函数以查看三角形是否有效,在我的函数上收到错误消息
- php - Laravel 路由来检查多个字符串
- django - Django中不同类型登录的不同视图?
- python - Tkinter 按钮获取变量未找到错误
- javascript - 使用秒/纳秒将 Javascript 日期上传到 Firestore
- flutter - Flutter 屏幕录制对话框按下
- html - 如何设置div表中列的宽度?
- javascript - 使用 Vue/Laravel 的动态 URL