Results 1 to 2 of 2
  1. #1
    roseheyworth is offline Member
    Join Date
    Nov 2007
    Rep Power

    Default Javascript - Password Arrays


    I am currently creating a password option for my website.

    So far I have about 5 people (hey its a start!! They're mates!!)

    I have those five passwords in an array called userPasswords.

    I have a 'userenterPassword = window.prompt('Please enter password.','');' set up to keep the password in memory.

    I have a var UserIndex = 1;

    Then I try to set up a for loop:

    for(count = 0; count < userPasswords[UserIndex]; count = count + 1)

    if(userenterPassword != userPasswords)

    'userenterPassword = window.prompt('Please enter password.','');


    It wont seem to go further this?

    Should I be using a WHILE loop for user password wrong entry?

    Please 'elp!


  2. #2
    clement1 is offline Member
    Join Date
    Nov 2007
    Rep Power


    I would use a while loop rather than an IF inside a FOR Loop.

    If your using passwords as a login to a website, i would use a database to store the details then use PhP to check the username & password against the database rather than just use an array within the website.

    This is my personal preference, although it is pretty easy to update the data and moify it when using the database.

Similar Threads

  1. Javascript Alert
    By mutuah in forum New To Java
    Replies: 4
    Last Post: 03-25-2010, 06:28 PM
  2. Javascript into Excel
    By gdj100 in forum Advanced Java
    Replies: 0
    Last Post: 03-12-2008, 12:03 PM
  3. please help with javascript code!!!!
    By sahkab in forum New To Java
    Replies: 1
    Last Post: 11-26-2007, 04:20 PM
  4. Jsp and javascript
    By Ed in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 07-04-2007, 05:54 AM
  5. javascript validation
    By yuchuang in forum New To Java
    Replies: 5
    Last Post: 05-14-2007, 04:38 PM

Posting Permissions

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