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!

odd textarea behaviour

Status
Not open for further replies.

crazyboybert

Programmer
Jun 27, 2001
798
GB
I am experiencing some really odd behaviour from a textarea in IE6. The project I am working on is IE6 only so i have no need to concern other browsers for this one.

The textarea has a width specifiec in css of 70%. As thepage resizes sop does the textarea - lovely. As soon as you enter anyt text into the box then the width jumps to not far off 100%.

Why?

If i add an onkeydown event and respecify the width as 70% this has no effect. However if I add an onkeypress event to do the same thing the width jumps up and back down again for the first key stroke in the textarea, for the next keystroke it jumps up and remains at not far off 100%.

Has anyone else experienced strange behaviour like this and have any ideas how to stop it?

Thanks up front

Rob ------------------------------------

Go placidly amidst the noise and haste,
find what peace there may be in silence.
-Anon

------------------------------------
 
Ive found a 'fix' for this if anyone is interested. The following events in the textarea tag solve the problem.

onfocus="this.style.width = this.clientWidth + 'px';"
onblur="this.style.width = '70%';"

I would still be interested to hear if anyone know shte cause of this behaviour.... ------------------------------------

Go placidly amidst the noise and haste,
find what peace there may be in silence.
-Anon

------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top