Home > Web Front-end > JS Tutorial > body text

Remove the default enter key submission in the form and bind the js method implementation code_javascript skills

WBOY
Release: 2016-05-16 17:38:36
Original
1087 people have browsed it
复制代码 代码如下:


onkeydown="javascript:if(event.keyCode==13) return false;"
onkeyup="javascript:if(event.keyCode==13) dosearch();"
class="swap_value" />
src="${ctx }/MINIUI/scripts/miniui/themes/default/images/img/btn_search_box2.gif"
width="36" height="26" id="go" alt="Search" title="Search" />


复制代码 代码如下:

function dosearch(){
var keywords=$("#s").val();
keywords=encodeURI(keywords);
keywords=encodeURI(keywords);
// window.open("${ctx}/DispatchAction.do?serviceName=SearchWeb&efFormEname=FS01&methodName=query&i-0-page=0&i-0-keywords=" keywords "&i-0-moduleId=bmoa_badc");
location.href="${ctx}/DispatchAction.do?serviceName=SearchWeb&efFormEname=FS01&methodName=query&i-0-page=0&i-0-keywords=" keywords;
}
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template