文本框应该允许字母数字 [英] Textbox should allow alpha numeric

查看:94
本文介绍了文本框应该允许字母数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai Everyone,



我有10个文本框。每个texbox只允许使用字母数字。[1-9]和[az]

有些文本框第一个字母应该是剩下的字母,将是数字。

首先是一些文本框两个字母应该是字母剩余的将是数字。



示例:

1)Textbox1:第一个字符应该是'M'剩余应该是数字

2)Textbox2:第一个字符应该是'W',剩下应该是数字

3)Textbox3:前2个字符应该是'DL'或'M'剩余应该是数字

4)Textbox4:前2个字符应为'PS'剩余应为数字



等......



任何人都可以使用通用javascipt函数帮助解决此问题

Hai Everyone,

I have 10 textboxes. each texbox has to allow only alphanumeric.[1-9] and [a-z]
Some textboxes first 1st letter should be alphabet remaining will be numbers.
And some textboxes first two letter should be alphabet remaining will be numbers.

Example:
1) Textbox1: 1st character should be 'M' remaining should be numbers
2) Textbox2: 1st character should be 'W' remaining should be numbers
3) Textbox3: 1st 2 characters should be 'DL' or 'M' remaining should be numbers
4) Textbox4: 1st 2 characters should be 'PS' remaining should be numbers

etc...

Can any one help on this with generic javascipt function

推荐答案

如果文本框的前缀或后缀是确定性的,没有必要要求用户记住并键入,只需将它们显示为文本框之前和之后的标签,然后前置或后备将它们转换为用户在提交前使用JavaScript输入的数字。至于只允许文本框中的数字,互联网上有很多例子,例如: http://stackoverflow.com/questions/7295843/allow-only-numbers-to-be-typed-in-a-textbox [ ^ ]。
If the prefix or suffix of a textbox is deterministic, there is no need to ask the user to remember and type, just display them as labels before and after the textbox, then prepend or append them to the number entered by the user using JavaScript before submission. As for allowing only numbers in the textbox, there are many examples on the Internet, such as this one: http://stackoverflow.com/questions/7295843/allow-only-numbers-to-be-typed-in-a-textbox[^].


这篇关于文本框应该允许字母数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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