动态设置文本框的大小 [英] dynamically set size of a textbox
本文介绍了动态设置文本框的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我必须在html中定义一个文本框,其最大大小应为3.现在,如果
我输入-100,那么这些是4个字符,但我希望该用户允许
输入100或-100.如果我定义size ="3",则它将不允许-100.
所以我想知道我们是否可以动态定义文本框的大小,即如果我输入
-符号,然后大小将增加到4,否则应为3.
我们可以使用js来做到这一点吗?
谢谢与问候,
Arvind
Hello Guys,
I have to define a textbox in html whose maximum size should be 3.Now If
I am entring -100 then these are 4 characters but I want that user should allow
to enter 100 or -100.If I define size="3" then it will not allow -100.
so i want to know can we define size of the textbox dynamically,i.e. if I enter
- sign then size will increase to 4 else it should be 3.
can we do this using js?
Thanks & regards,
Arvind
推荐答案
u可以测试用户是否输入了-"
如果他输入-",则根据您的要求检查长度
我认为这很容易
抱歉,如果我误会了
u can test whether the user entered ''-'' or not
if he enters ''-'' then check the length according u r requirement
its easy i think
sorry, if i misunderstand
这篇关于动态设置文本框的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文