On Mon, 6 Nov 2000 13:16:30 -0500, "J.Milks" <[EMAIL PROTECTED]> wrote:

>Can anyone suggest the best method to limit the number of characters =
>entered into a textarea?
>I seem to remember someone offering JS code that did just that on this =
>list.

I use this function:

<script language="JavaScript">
//limit number of chars in a textfield
function textChecker(field, maxlimit) {
        if (field.value.length > maxlimit)
        field.value = field.value.substring(0, maxlimit);
}
</script>

Called like this:

<textarea onKeyDown="textChecker(this,1000);"
onKeyUp="textChecker(this,1000);"
onChange="textChecker(this,1000);"></textarea>

Where "1000" is the number of characters to limit the field to.

HTH,
K.
______________________________________________________
Kay Smoljak - HTML/ColdFusion Developer - PerthWeb Pty Ltd
Internet Solutions for your business!

Level 9/105 St George's Tc - Perth - Western Australia
Ph: (08) 9226 1366 Fax: (08) 9226 1375 Mobile : 0419 949 007
Visit Perth online! : www.perthweb.com.au

------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to