Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Input Text Size Dynamically

Status
Not open for further replies.

jsulman

Programmer
Jun 14, 2001
85
US
Is there a way I can change the size of a input text dynamically?

I have a form with the following field:
<input type="text" name="month" id="dobMonth" size = "1">

I hoped I could do something like this:

var vMonth = document.getElementById("dobMonth") vMonth.size= 8

and have the size change on the form but it does not work. The size stays the same.

Thank you in Advance


jsulman
 
Do you want to change the size of the text in the textbox or the length (how many characters it can display) of the textbox.

The Size attribute changes the length of the text box.

How are you calling the script?
Technically speaking it should work like that.

Probably a typo, but both of your assignments are missing semi colons ";" at the end.




----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
I figured it out. Use a css and modify the object.style.width property.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top