当前位置:首页> 文章> HTML

Form表单和普通按钮实现搜索跳转功能

:2022-03-31   :格展网络   :59

form表单实现搜索跳转功能

使用post请求

html代码


<form name="forminfo1" method="post" action="/Search">
      <input name="filter" type="text" class="search" placeholder="产品搜索">
      <input name="" class="btn_search" type="submit" value="">
</form>


非form表单实现搜索跳转功能

使用js操作搜索功能


<input type="text" name="keyword" id="keyword" class="search_text" placeholder="请输入关键字"/>
<button type="submit" class="btn_submit btn_search" value="" id="search" onclick="javascript:window.location.href='/news/search.html?keyword='+ document.getElementById('keyword').value"></button>



上一篇:没有了!

下一篇:HTML表单