• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Guys i need help woth javascript

InSaN|tY

OSNN Junior Addict
#1
Ok i know this is too much to ask, but i have to create this login page here's a description

A GUI login screen is to be displayed with the following GUI objects:

- userID text box named "txtUserID"
- password text box named "txtpassword"
- login button to call "authenticate(userIn, passIn)" named "btnLogin"
- appropriate prompts and messages

create the code in three modules (files):

login.html
- displays the GUI login screen


init.js (instead of owners.js, managers.js)
- initializes variables
- populates data arrays
the data for these will be provided as two lists of names & passwords
one list will contain names of managers and the other will be owners

login.js
- holds the functions
1. authenticate(userIn, passIn)
2. goToURL(nextWebPage)

Description of the Login authentication program:

We need to identify the user type as manager, owner or ordinary

when the user attempts to log in to the system
- the lists of users is searched for a match with the userID
- if a match for userID is found, the pIN is checked
if the pIN is correct the user is admitted to the system either as a manager or an owner
- otherwise the user is prompted to check the userID and pIN or to proceed to the ordinary user's page

glossary:

authentication = the user's userID and pIN are verified
attempt to log in = user enters userID and pIN
userID = 3 to 14 characters
pIN = 4 digit number
admitted to the system as owner = display Owner's Welcome page
admitted to the system as manager = display manager's Welcome page
Suggested steps for the solution:

1. Store userID's and PIN's in parallel arrays or a single object array;

example of parallel arrays

userID = new Array("Fred", "Sally", "Judy");
pIN = new Array( 0000, 1111 ,2222);

2. get the items entered by the user from the form; eg.

onClick= "authenticate(user, pin)"

3. Search the userID array for a match; eg.

for (i = 0; i < userID.length; i++)
{ if (userID == user)
{ processPin;
break;
}
... and so on

Suggested preliminary steps:

-2. experiment with getting data from a form

-1. experiment with the arrays of users; eg.
display their userID's and pIN's on the screen
with a function called displayUsers()

function displayUsers()
{ document.write("Number userID pIN ");
for (i = 0; i < userID.length; i++)
{ document.write(i + ". " + userID + " " pIN + "."); }
}


does anyone know where i can find soething that wud help me with this, or could anyone here help me with this? Thx in advance
 

Members online

No members online now.

Latest posts

Latest profile posts

Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,961
Messages
673,239
Members
89,014
Latest member
sanoravies