问题
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