<form target="frameFile" id="search_from">
<input class="search_in" type="search" placeholder="请输入关键词" />
<iframe name='frameFile' style="display: none;"></iframe>
</form>
像这样加个iframe标签就可以了,将from的target对应到iframe的那么就是不会改变当前页面的链接,也就不刷新了
有许多时候我们点击搜索以后会出现比较长的列表,软键盘会盖住用户搜索的信息,我们点击一下屏幕才会使软键盘消失,这样用户体验也不是很好,所以我们可以在调用的方法中加一个软键盘收起的方法
document.getElementById('search_from').onsubmit = function(e){
yourfun();
document.activeElement.blur();//软键盘收起
}
---------------------
作者:WebSunshine
来源:优快云
原文:https://blog.youkuaiyun.com/github_39237934/article/details/75258285
版权声明:本文为博主原创文章,转载请附上博文链接!