Ask Experts Questions for FREE Help !
Ask
    boobiesonthetree's Avatar
    boobiesonthetree Posts: 2, Reputation: 1
    New Member
     
    #1

    Feb 11, 2008, 12:32 PM
    Javascript language for counting characters
    I wonder if anyone can help me please,

    I am trying to write code into my program
    The code needs to be for counting characters in a password
    The user enters a password which must be between 7-15 characters long
    If the user enters outsuide this rule then an error message must come up stating exactly how many characters the user did enter and telling them it must be between 7-15 characters.
    I have managed to do the error message for the wrong amount of characters but I can't get my head around displaying the amount of characters the user entered
    If anybody can help pleaseeeee do thank you

    Emma
    manchester thani's Avatar
    manchester thani Posts: 14, Reputation: 1
    New Member
     
    #2

    Mar 31, 2008, 08:39 AM
    Try using indexAt and charAt methods buddy... but I am not sure..
    jstrike's Avatar
    jstrike Posts: 418, Reputation: 44
    Full Member
     
    #3

    Apr 9, 2008, 01:40 PM
    Code:
    function checkPassLength(password);
      var passLen = password.length;
      if(passLen<7) {
        alert("You entered " + passLen + " characters, your password is too short.");
        return false;
      }
    
      if(passLen>15) {
        alert("You entered " + passLen + " characters, your password is too long.");
        return false;
      }
    
      return true;
    }

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

How to change language in 'Regional and Language Options' without restarting? [ 2 Answers ]

Hi there! On windows I have to work on 3 languages, Japanese, English and Thai. Some programs I use don't work on Thai-English windows, so I have to switch the window language to Japanese-English in 'Regional and Language Options' and it restart every time. There's any ways to set window...

Counting Items [ 1 Answers ]

If a variable in column A fulfills a certain condition, I have it listed in column B Column A Q W E R T

35 weeks and counting [ 9 Answers ]

Hi all it's me Jnet29 I have a question, for the last week I have been having headaches, nausea and I have been seeing spots for two days and my back have been killing me and I'm going to the bathroom like crazy can anyone tell me what's going on?

34 weeks and counting [ 7 Answers ]

Well the dr said that he wants me to wait till Friday before going into labor. He also wrote a perscription to help make that possible. The babies are 4lbs 4oz and doing great. I have an appointment next week, he said if I make it that long. I am one and a half cm dialated and measuring full term...

First language literacy and second language litera [ 1 Answers ]

What are the differences between first language literacy and second language literacy?


View more questions Search