ausghostdog

New functions

Nov 2nd, 2011
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. //declare and set user information
  2. var users = new Array();
  3.  
  4. users["john smith"] =
  5. {
  6. "accountname" : "JSmith",
  7. "password" : "jsmi123",
  8. "accountbalance" : "$530.00",
  9. "accountnumber" : "997766",
  10. "customername" : "John smith"
  11. }
  12.  
  13.  
  14. //declare and set item details
  15.  
  16.  
  17.  
  18.  
  19. function validatelogin()
  20. {
  21. //assign user entered into to variables
  22.  
  23. var LoggedAccountNumber = document.getElementById('accountnumber').value;
  24. var LoggedAccountName = document.getElementById('accountname').value;
  25. var LoggedPassword = document.getElementById('password').value;
  26. // loop through the users array to find a match
  27.  
  28. for (i in users)
  29. {
  30. if (users[i]["accountnumber"] == LoggedAccountNumber && users[i]["accountname"] == LoggedAccountName && users[i]["password"] == LoggedPassword)
  31. {
  32. document.cookie = [i];
  33. flag = true;
  34. alert (document.cookie);
  35. }
  36. }
  37. if (flag == true)
  38. {
  39. window.open ("products.html");
  40. }
  41. else
  42. {
  43. alert ("incorrect details. please try again");
  44. }
  45.  
  46.  
  47. }
  48. function validatelogin()
  49. {
  50. //assign user entered into to variables
  51.  
  52. var LoggedAccountName = document.getElementById('accountname').value;
  53. var LoggedPassword = document.getElementById('password').value;
  54. // loop through the users array to find a match
  55.  
  56. for (i in users)
  57. {
  58. if (users[i]["accountname"] == LoggedAccountName && users[i]["password"] == LoggedPassword)
  59. {
  60. document.cookie = [i];
  61. flag = true;
  62. alert (document.cookie);
  63. }
  64. }
  65. if (flag == true)
  66. {
  67. window.open ("products.html");
  68. }
  69. else
  70. {
  71. alert ("incorrect details. please try again");
  72. }
  73.  
  74.  
  75. }
  76.  
  77. function validateDeposit()
  78. {
  79. var DepositAmount = document.getElementById("depositamount").value;
  80. var totalAmount =parseFloat(DepositAmount) + (accountbalance);
  81. alert(totalAmount);
  82. }
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
Advertisement
Add Comment
Please, Sign In to add comment