56 users online (0 members and 56 guests)  


  Results 1 to 5 of 5

Related

  1. Limited Traffic Offer - 0.67$/1.000 visitors    Forum: Internet Services
    Replies: 0
  2. Replies: 4
  3. Replies: 0
  1. #1
    andytheguita's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2003
    Posts
    1

    Limited Textarea

    Hi. I wanto to limit scrolls of textarea. I con't want users type more rows than the rows declared in the <textarea rows=..>
    How can i do ?

    I' don't wnat to limit the number of characters, bot the rows to avoid scrolling....

    Bye....thanks....

  2. #2
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel
    AHFBWEB Less customers per server, more power for you!

    Business Class Shared Hosting

  3. #3
    Doorknob's Avatar
    Super Newbie

    Status
    Offline
    Join Date
    Jun 2002
    Location
    Malaysia
    Posts
    316
    u can't. u CAN limit the number of chars though, using javascript.

    **************************************************
    <head>
    <script language=Javascript>
    <!--
    function LimitChars()
    {
    var MostChars = 100;
    var CurrentChars = document.FormName.testTextArea.length
    if CurrentChars >= MostChars
    {
    document.FormName.testTextArea.disabled = true;
    }
    else
    {
    document.FormName.testTextArea.disabled = false;
    }
    }
    -->
    </script>
    </head>
    **************************************************
    <form name="FormName">
    <textarea name=testTextArea onKeyUp="LimitChars();">
    Default Text
    </textarea>
    </form>

  4. #4
    Doorknob's Avatar
    Super Newbie

    Status
    Offline
    Join Date
    Jun 2002
    Location
    Malaysia
    Posts
    316
    i THINK i got the function right. ah well...

  5. #5
    Beery's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2003
    Posts
    3

    Wink

    Hi
    I try to post my version of the solution of this task.

    Head Section:

    Code:
    <script language=Javascript>
    function Checker(value)
    {
    var MaxChars=document.YourForm.YourTextArea.cols * document.YourForm.YourTextArea.rows
    if (window.event.keyCode == 13) {document.YourForm.YourTextArea.blur();}
    document.YourForm.YourTextArea.value = value.substring(0, MaxChars - 1)
    }
    </script>
    Body Section:

    Code:
    <form name="YourForm">
    <textarea rows=3 name=YourTextArea onkeypress="Checker(this.value);"></textarea>
    </form>
    Limited Text Area Sample
    http://www.unixcities.com/dhtml/textarea/



Tags for this Thread