Form表单和普通按钮实现搜索跳转功能
form表单实现搜索跳转功能:
使用post请求实现form表单是常见的一种提交形式,可以方便的将表单数据提交到后台,在不方便使用form表单时还可以通过另一种方式进行搜索跳转,以下就是两种跳转方式的不同实现代码:
相关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>
发表评论
本站使用PbootCMS自带留言实现单文章留言!