HDI:在HTML输入框禁用回传 [英] HDI: Disable postback on html input box
本文介绍了HDI:在HTML输入框禁用回传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有我不想在别人醒目回车键出现回发一个输入框
我想要的JavaScript事件发生吧。
<输入
TYPE =文本
ID =addressInput
的onkeydown =inputenter()
的AutoPostBack =FALSE/> 功能inputenter(){
如果(event.key code == 13){
seachLocations();
返回false;
}
其他{
返回false;
}
}
解决方案
特别鸣谢:的 http://www.beansoftware.com/ASP.NET-Tutorials/Accept-Enter-Key.aspx
<输入类型=文本ID =addressInput的onkeydown =如果(window.event.key code == 13)
{
event.returnValue =虚假的;
event.cancel = TRUE;
searchLocations();
}/>
I have an input box that I don't want postback to occur on someone striking the enter key
I want the javascript event to take place instead.
<input
type="text"
id="addressInput"
onkeydown="inputenter()"
autopostback="false"/>
function inputenter() {
if (event.keyCode == 13) {
seachLocations();
return false;
}
else {
return false;
}
}
解决方案
Special thanks to: http://www.beansoftware.com/ASP.NET-Tutorials/Accept-Enter-Key.aspx
<input type="text" id="addressInput" onkeydown="if (window.event.keyCode == 13)
{
event.returnValue=false;
event.cancel = true;
searchLocations();
}" />
这篇关于HDI:在HTML输入框禁用回传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文