后退空间在文本框中不起作用 [英] Back Space is Not working in textbox

查看:66
本文介绍了后退空间在文本框中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,





我有多行文本框,当我达到2000个字符时,我的退格按钮不起作用

你能指导我或发送片段









< asp:textbox ID =txtMydescritpionrunat =servermaxheight =200pxTabIndex =7onkeypress =return textboxMultilineMaxNumber(this,2001,event); MaxLength =2000

工具提示=描述TextMode =MultiLine宽度=100%

高度=70px>

$ b



< script type =text / javascript>

function textboxMultilineMaxNumber(txt ,maxLen,evt){



if(txt.value.length>(maxLen - 1)){



返回false;

}

}

< / script>

Hi All,


I Have multiline text box when I reaches 2000 characters my backspace button is not working
Can you guide me or send snippets




<asp:textbox ID="txtMydescritpion" runat="server" maxheight="200px" TabIndex="7" onkeypress="return textboxMultilineMaxNumber(this,2001,event);" MaxLength="2000"
ToolTip="Description" TextMode="MultiLine" Width="100%"
Height="70px">



<script type="text/javascript">
function textboxMultilineMaxNumber(txt, maxLen, evt) {

if (txt.value.length > (maxLen - 1)) {

return false;
}
}
</script>

推荐答案

onkeypress="return textboxMultilineMaxNumber(this,2001,event);" 



你刚刚越过2000边界时阻止了按键事件......

你的函数将在长度时返回false超过2000,这将进一步阻止事件的传播,所以没有德将采取错误行动(并且不会在任何地方采取任何行动)......


You just blocked the keypress event when crossing the 2000 border...
Your function will return false when the length is over 2000 and that will stop the propagation of the event further, so no default action will be taken (and no action of yours anywhere)...


这篇关于后退空间在文本框中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆