Input prompt

Discussion in 'Javascript' started by Christopher Benson-Manica, Sep 25, 2003.

  1. Is there a way to limit the amount of text a user may type into an input
    dialog box (like window.prompt("Enter a 10 character value"))?

    --
    Christopher Benson-Manica | Jumonji giri, for honour.
    ataru(at)cyberspace.org |
    Christopher Benson-Manica, Sep 25, 2003
    #1
    1. Advertising

  2. Christopher Benson-Manica

    Lee Guest

    Christopher Benson-Manica said:
    >
    >Is there a way to limit the amount of text a user may type into an input
    >dialog box (like window.prompt("Enter a 10 character value"))?


    <html>
    <body>
    <script type="text/javascript">
    var pword="";
    var msg="Please enter a 10 character value";
    var expletive=", dammit!";
    while(pword.length!=10){
    pword=prompt(msg);
    msg+=expletive;
    expletive="";
    }
    document.write("Thank you for entering \""+pword+"\"");
    </script>
    </body>
    </html>
    Lee, Sep 25, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. zhi
    Replies:
    11
    Views:
    518
  2. Replies:
    12
    Views:
    1,815
  3. gaurav kashyap
    Replies:
    2
    Views:
    607
    gaurav kashyap
    Oct 30, 2008
  4. gaurav kashyap
    Replies:
    3
    Views:
    673
    gaurav kashyap
    Oct 31, 2008
  5. Mel
    Replies:
    10
    Views:
    3,097
    Sailaja Appi
    Feb 13, 2009
Loading...

Share This Page