http://www.experts-exchange.com/Web/Web_Languages/HTML/Q_20781420.html

Hi
I am using Textarea type.I want to set maximum length to the textarea.
I am using following code for the same,but it is not working,
<textarea name="txtDescription" cols=10 rows=3 maxlength=50></textarea>
But it is not working,it takes chars beyond 50 also.
Help me inthe same
Comment from seanpowell
Date: 10/29/2003 02:14AM PST
Comment

</form>

Thanks

Comment from chitramahadik
Date: 10/29/2003 02:21AM PST
Author Comment

javascript function onChange event of TExtarea ,it will work but I can't specify maxlength=50 to TextArea object,the same is working for Text object.

Comment from seanpowell
Date: 10/29/2003 02:27AM PST
Comment


Accepted Answer from DelTreme
Date: 10/30/2003 02:24AM PST
Grade: B
Accepted Answer

          oTR.text = sData;
     }
}
</SCRIPT>

</PUBLIC:COMPONENT>

Comment from kingromes
Date: 06/07/2004 01:06PM PDT
Comment

Mozilla Firefox).

Neat trick tho'

Comment from nishaj
Date: 07/13/2004 11:41AM PDT
Comment

I could not make this work using IE6/javascript. Maybe I am doing something wrong.

Added the line to the css as above to add the behavior to TEXTAREA.

Added the htc file with the code from above - just changed the SCRIPT LANGUAGE = Javascript.

Used the input tag as <TEXTAREA MAXLENGTH=5> as a test.

It just doesn't do anything.


Comment from gfdos
Date: 09/03/2004 10:33AM PDT
Comment


Comment from bharatpanthee
Date: 12/16/2004 03:02AM PST
Comment


</form>
</body>


I think this will help u.

Comment from biffsmith
Date: 03/04/2005 06:00AM PST
Comment


Since it doesn't work I'm sure I've got it wrong.  Can you take it one step further and advise as to the correct syntax?  Will this even work with more than one textarea field?

Thank you!

Administrative Comment from seanpowell
Date: 03/04/2005 06:07AM PST
Administrative Comment

Hi biffsmith,

You'll need to cerate a new question for this.

Thanks,
Sean Powell
HTML PAge Editor

Comment from presbria
Date: 08/10/2005 01:21PM PDT
Comment



Passing the form object and using it's methods.  Pretty simply and painless.


 

Comment from presbria
Date: 08/10/2005 01:22PM PDT
Comment

Oh, that answered both questions too!!!

I know, I'm too late, but I think it's still the best way to do it, if not, please let me know a better one.

Thx.

Comment from mdmeighan
Date: 08/22/2005 01:10PM PDT
Comment

相关文章: