View Full Version : Onmouseover change text width?

Nov 8th, 2006, 11:27 AM
Is it possible, to change the width of a textbox on the mouseover control? For example, if the default size of the textbox is 104px, is it possible to change the width to say 184 onmouseover? If so, what is the code? Thanks you.

Nov 8th, 2006, 04:31 PM
Yes it is possible.

here is an example.

<input type="text" onmouseover="javascript: this.style.width='180px';">

You can do the same thing for onmouseout so you can re-instantiate the width to its original value.

By the way, it might be better to defines a couple of CSS class for original width and another for for the onmouseover effect. if you do that, you can then say onmouseover="javascript: this.style.className='class_name_here'"

good luck

Nov 9th, 2006, 04:54 PM
Thank you so much! I'm quite new to javascript so yeah, I don't really know much. But thank you so much!