我正在尝试使用单选按钮来确定用户按Enter键时重定向的位置。
我遇到的问题是,当我选择单选按钮并按回车键时,URL将填充“searchpage?searchradios = animalname”
下面是一个基本示例的片段
picture showing the involuntary addition to the URL
<div class="row">
<div class="col-xs-6" align="center">
<div class="input-group">
<span class="input-group-addon">
<input type="radio" name="searchradios" value="animalname">Animalname
</span>
<input type="text" class="form-control" aria-label="...">
</div>
<!-- /input-group -->
</div>
<!-- /.col-lg-6 -->
</div>
<!-- /.row -->
计划是有一个触发脚本的按钮,该脚本将确定所选的单选按钮,并使用window.location.href确定要重定向到哪个页面,但是文本字段会自动将有关单选按钮的信息添加到href执行的URL中不起作用,只重新加载包含图片中不需要的信息的页面。
没有看到你的整个形式,很难知道,但似乎你正在做一个GET而不是POST。