我可以修改文本框以接受文本和数值吗? [英] Ho do I modify my textbox to accept both text and numeric values?

查看:58
本文介绍了我可以修改文本框以接受文本和数值吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含不同类型控件的Web表单应用程序。我有一个文本框,截至目前只接受数值。一旦我输入一封信,信就会出现,然后退格。输入数值时我没有这个问题。



这是创建文本框的html:

I have a web forms application with varying types of controls. I have a textbox that as of right now only accepts numeric values. As soon as I type a letter, the letter will appear and then backspace. I don't have this issue when entering numeric values.

Here is the html that creates the textbox:

<div class="FloatLeft">
                <span class="DataPromptLeft">Alpha Number</span><span class="RequiredIndicator"></span><br />
                <asp:TextBox ID="uxLineNumTxt" runat="server" CssClass="TextControlMedium" MaxLength="14" onkeyup="NumericKeyUp(this);" Width="152px"></asp:TextBox>
            </div>



我相信onkeyup =numericKeyUp(this);是什么让我的文本框表现如前所述。我研究了这个问题以及onkeyup目的/功能。我遇到的一切都是为了让文本框只接受数字值,这与我想要的相反。



关于如何处理这个的任何想法?


I believe the onkeyup="numericKeyUp(this); is what is making my textbox behave as previously described. I researched this issue as well as the onkeyup purpose/ functionality. Everything I came across was oriented towards getting a textbox to only accept numeric values, which is the opposite of what I want.

Any ideas on how to approach this?

推荐答案

如果你不想过滤输入文本框中的字符,然后删除 onkeyup 属性。 javascript函数名称NumericKeyUp表明这是导致您看到的行为的原因。
If you don't want to filter the characters entered into the textbox, then remove the onkeyup attribute. The javascript function name "NumericKeyUp" suggests that this is what's causing the behaviour you're seeing.


这篇关于我可以修改文本框以接受文本和数值吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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