网页中的文本框验证 [英] Textbox validation in a webpage
本文介绍了网页中的文本框验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我是DotNet的新手.
在网页中,我有一个名称为Status的文本框.我需要限制用户在文本框中仅输入Yes或No.
从这个帮助我
或者.
我可以使用下拉菜单,但应该只有文本框.
在此先感谢.
Subhash G.
解决方案
如果唯一的可能性是Yes
和No
,我会考虑使用CheckBox
而不是文本进行输入.
您可以使用 JavaScript [ http://kottawadumi.blogspot.com/2010/05/how-to- validate-textbox-using.html [ ^ ]
使用单选按钮或复选框.因为您可以选择是"或否",所以比文本框"更好.
Hi All,
I am new to DotNet.
In a webpage I have one Textbox name as Status.I need to restrict the user to enter only Yes or No in the Textbox.
Help me out from this
Alternatively.
I can do with dropdown but there should be only textbox.
Thanks in Advance.
Subhash G.
解决方案
If the only possibilities areYes
andNo
, I would consider using aCheckBox
rather than text for input.
You can use Javascript[^] for validating your textbox. There are plenty of examples on the Internet about this.
[Update]
The link below is a good example of validating a textbox using Javascript.
http://kottawadumi.blogspot.com/2010/05/how-to-validate-textbox-using.html[^]
Use Radio Button or Check Box. Because you have the option as Yes or No. that will be better instead of Textbox.
这篇关于网页中的文本框验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文