Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //declare and set user information
- var users = new Array();
- users["john smith"] =
- {
- "accountname" : "JSmith",
- "password" : "jsmi123",
- "accountbalance" : "$530.00",
- "accountnumber" : "997766",
- "customername" : "John smith"
- }
- //declare and set item details
- function validatelogin()
- {
- //assign user entered into to variables
- var LoggedAccountNumber = document.getElementById('accountnumber').value;
- var LoggedAccountName = document.getElementById('accountname').value;
- var LoggedPassword = document.getElementById('password').value;
- // loop through the users array to find a match
- for (i in users)
- {
- if (users[i]["accountnumber"] == LoggedAccountNumber && users[i]["accountname"] == LoggedAccountName && users[i]["password"] == LoggedPassword)
- {
- document.cookie = [i];
- flag = true;
- alert (document.cookie);
- }
- }
- if (flag == true)
- {
- window.open ("products.html");
- }
- else
- {
- alert ("incorrect details. please try again");
- }
- }
- function validatelogin()
- {
- //assign user entered into to variables
- var LoggedAccountName = document.getElementById('accountname').value;
- var LoggedPassword = document.getElementById('password').value;
- // loop through the users array to find a match
- for (i in users)
- {
- if (users[i]["accountname"] == LoggedAccountName && users[i]["password"] == LoggedPassword)
- {
- document.cookie = [i];
- flag = true;
- alert (document.cookie);
- }
- }
- if (flag == true)
- {
- window.open ("products.html");
- }
- else
- {
- alert ("incorrect details. please try again");
- }
- }
- function validateDeposit()
- {
- var DepositAmount = document.getElementById("depositamount").value;
- var totalAmount =parseFloat(DepositAmount) + (accountbalance);
- alert(totalAmount);
- }
Advertisement
Add Comment
Please, Sign In to add comment