how to format textbox entry client side

不想你离开。 提交于 2020-01-06 09:58:33

问题


Q:

I wanna to mask my textbox , so if the user enter the number one for example it formatted as

0000001 how to do this ,any number in 7 digits.


回答1:


I think you are going to need something like this padding function.

You could listen for a keypress then as soon as it is fired, use getElementById() to get your elements content, you could then run the padding function on it and put the padded value back in.




回答2:


I think you need to use MaskedEditExtender in Ajax. Set its properties such as TargetControlID as your TextBox name, MaskType="Number", Mask="9999999" and AutoComplete="true". I hope it will work fine.



来源:https://stackoverflow.com/questions/4667271/how-to-format-textbox-entry-client-side

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!