如何在 ASP.net 文本框中将条目限制为 0-9、space 和逗号
How to limit entry to just 0-9, space and comma in an ASP.net textbox
拜托,我无法让它工作:
我尝试过其他解决方案from here
<asp:TextBox ID="txtNumber"
onkeyup="this.value = this.value.replace(/^[0-9 ,]+$/, '')"
runat="server"
Width="250px"
ToolTip="You may enter multiple numbers separated by comma"
Wrap="False"
placeholder="Enter phone numbers separated by comma">
</asp:TextBox>
我想在 ASP.net 文本框中将条目限制为 0-9、space 和逗号
如果要替换,则必须使用否定集。试试这个:[^0-9 ,]+$
如果发现无效条目,这将重置文本框。 (假设这就是您正在尝试的)
拜托,我无法让它工作: 我尝试过其他解决方案from here
<asp:TextBox ID="txtNumber"
onkeyup="this.value = this.value.replace(/^[0-9 ,]+$/, '')"
runat="server"
Width="250px"
ToolTip="You may enter multiple numbers separated by comma"
Wrap="False"
placeholder="Enter phone numbers separated by comma">
</asp:TextBox>
我想在 ASP.net 文本框中将条目限制为 0-9、space 和逗号
如果要替换,则必须使用否定集。试试这个:[^0-9 ,]+$
如果发现无效条目,这将重置文本框。 (假设这就是您正在尝试的)