| Author |
dynamic size for input box
|
Chris O'Neill
Greenhorn
Joined: Jul 24, 2006
Posts: 4
|
|
Hi, I have an input box which needs to be able to change in size depending on the number of characters that are fed into it when the page is loaded. Is there a way of setting the size="" parameter to take in a dynamic variable equal to the length of the figure fed into it? At the moment it just renders at a fixed size and that doesn't accomodate to my design wishes. Thanks
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24081
|
|
Hi, Welcome to JavaRanch! Are we talking about HTML or about a Java Swing GUI?
|
[Jess in Action][AskingGoodQuestions]
|
 |
Chris O'Neill
Greenhorn
Joined: Jul 24, 2006
Posts: 4
|
|
Hi, It's on a HTML page. <input type="text" size="?var?" etc..>
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24081
|
|
|
OK, cool. We have a forum for HTML and Javascript here. I'm going to move this topic there, and I'm sure someone will be able to give you a good answer.
|
 |
Jaikiran Pai
Marshal
Joined: Jul 20, 2005
Posts: 8210
|
|
Is this what you want: The size of the textbox will change depending on the length of the string 'someString' [ July 25, 2006: Message edited by: jaikiran pai ]
|
[My Blog] [JavaRanch Journal]
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15362
|
|
The thing is setting a length of a string to the size of a textbox will still be wrong. type in a bunch of i or spaces or w and see what happens. You will see you are not going to get a good fit, but it will work just fine. Eric
|
 |
Chris O'Neill
Greenhorn
Joined: Jul 24, 2006
Posts: 4
|
|
yes that does the job. Thanks
|
 |
 |
|
|
subject: dynamic size for input box
|
|
|