Professional Web Applications Themes

Is there a way to only allow a textarea to hold a certain # of characters? - Macromedia Dreamweaver

Is there a way to only allow a text area to hold a certain amount of characters? What I mean by this, is when you type in it, it will only allow you to type up to a certain # of characters or lines, and then will not scroll, or move down in anyway. I don't know of any HTML attributes that can do this, or CSS, but I'm open for suggestions. Thanks!...

  1. #1

    Default Is there a way to only allow a textarea to hold a certain # of characters?

    Is there a way to only allow a text area to hold a certain amount of characters?

    What I mean by this, is when you type in it, it will only allow you to type up to a certain # of characters or lines, and then will not scroll, or move down in anyway.

    I don't know of any HTML attributes that can do this, or CSS, but I'm open for suggestions. Thanks!



    mherchel webforumsuser@macromedia.com Guest

  2. #2

    Default Re: Is there a way to only allow a textarea to hold a certain # of characters?

    Hi again,

    If you have the time/patience then a great place to learn HTML and other web design stuff is webmonkey.com



    roudh webforumsuser@macromedia.com Guest

  3. #3

    Default Re: Is there a way to only allow a textarea to hold a certain # of characters?

    On Wed, 16 Jul 2003 20:20:43 +0000 (UTC), "mherchel"
    [email]webforumsusermacromedia.com[/email] wrote:
    >Is there a way to only allow a text area to hold a certain amount of
    >characters?
    >
    >What I mean by this, is when you type in it, it will only allow you
    >to type up to a certain # of characters or lines, and then will not
    >scroll, or move down in anyway.
    Try this example, which limits the length of the input to ten
    characters. To set the length to something different, just change
    checkLen(this, n) where n is the maximum number of characters you want
    to allow.


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Untitled Doent</title>
    <meta http-equiv="Content-Type" content="text/html; cht=utf-8">
    <script type="text/javascript">
    function checkLen(o, l){
    if (o.value.length > l){
    s=new String(o.value);
    o.value = s.substr(0,l);
    }
    }
    </script>
    </head>

    <body>
    <form name="form1" method="post" action="">
    <textarea name="textarea" onKeyUp="checkLen(this, 10)"></textarea>
    </form>
    </body>
    </html>


    Gary
    Gary White Guest

  4. #4

    Default Re: Is there a way to only allow a textarea to hold a certain # of characters?

    Thanks Gary, that's exactly what i was looking for.

    I did do research before I asked, but couldn't find the answer. Thanks for the help everyone.


    mherchel webforumsuser@macromedia.com Guest

Similar Threads

  1. Show first 25 characters or so of textarea
    By sattman in forum Coldfusion - Getting Started
    Replies: 2
    Last Post: November 6th, 12:33 AM
  2. problems with some characters in TEXTAREA
    By alpenman in forum Macromedia ColdFusion
    Replies: 8
    Last Post: March 1st, 12:05 AM
  3. Replies: 1
    Last Post: September 10th, 04:55 AM
  4. Textarea - Limit Amount of Characters?
    By Richard Hockey in forum PHP Development
    Replies: 2
    Last Post: August 23rd, 04:34 AM
  5. Replies: 1
    Last Post: August 12th, 03:28 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139