如何采取字符串或数字..在txtbox [英] how to take either String or numbers..in txtbox

查看:66
本文介绍了如何采取字符串或数字..在txtbox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的项目中...在其中一个文本框中...我需要采取数字数字或 NULL ..我没有任何想法..任何人都可以帮助我..我的jsp代码和js代码...

login.jsp


in my project...in one of the textbox...i need to take either numbersnumbers or NULL..im not getting any idea..can anyone help me out..here is my jsp code and js code..

login.jsp

展开 | 选择 | Wrap | 行号

推荐答案

我不明白你的检查逻辑。你可以测试输入是否符合isFinite()或isNaN()的数字(parseInt()也是一个很好的起点,甚至可以使用RegExp)以及如何测试NULL和NULL。我希望不必解释。
I don’t understand your checking logic. you can test, whether an input qualifies for a number with either isFinite() or isNaN() (parseInt() would be a good starting point either, even RegExp were possible) and how to test for "NULL" I hopefully don’t have to explain.




i用值来检查..如果我给了''NULL''它正在接受,如果我给''NULL123''也在采取...但我需要的是它应该采取数字或NULL意味着

L-Acct。无----> NULL



L-Acct。无----> 123



喜欢这个我需要我使用RegExp..eventhough我没有得到你可以建议我怎么做..

i checked with the values..if i had given ''NULL'' it is taking and if i give ''NULL123'' is also taking...but i need is it should take either numbers or NULL that means

L-Acct. No.----> NULL
or
L-Acct. No.----> 123


like this i need i used RegExp..eventhough im not getting can u suggest me how to do..


您对RegExp有多熟悉?
how familiar are you with RegExp?


这篇关于如何采取字符串或数字..在txtbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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