如何让用户仅在一个文本框中插入值 [英] How to privent user to insert value only one textbox

查看:73
本文介绍了如何让用户仅在一个文本框中插入值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我
我有两个asp:textbox,我希望用户仅输入一个文本框的值
如果客户端在textbox1中输入值,那么他们不会在textbox2中输入值;如果客户端在textbox2中输入值,那么他们不会在textbox1中输入值.

Please help me
I have two asp:textbox i want at time user enter value only one textbox
if client enter value in textbox1 then they not enter the value in textbox2 and if client enter value in textbox2 then they not enter the value in textbox1

推荐答案

相当多的JavaScript可以做到这一点.如果要在一个框中键入另一个,则擦除一个框;如果另一个具有值,则禁止输入一个.

另一种方法是只允许一个可见,并让用户选择.还有一些js可以做到这一点.

请正确标记您的问题.如果您只是说文本框",那么您帖子中的任何内容都不会告诉我这是一个网络应用程序
You need to write a fair bit of javascript to do this. Either erasing one box if they type into the other, or forbidding input into one if the other has a value.

The other way is to only allow one to be visible, and let the user choose. Still some js to do that.

Please tag your questions properly. If you''d just said ''textbox'', nothing in your post would have told me this was a web app


这篇关于如何让用户仅在一个文本框中插入值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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