Advertisement
Guest User

Untitled

a guest
Feb 13th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.  
  4. <head>
  5. <title>Signup</title>
  6. <script>
  7. function addUser() {
  8. var user = new Object();
  9.  
  10. user.username = document.getElementById("username").value;
  11. user.password = document.getElementById("password").value;
  12.  
  13. var addUser = new XMLHttpRequest();
  14.  
  15. addUser.open("POST", "/signup", true);
  16.  
  17. addUser.setRequestHeader("Content-Type", "application/json");
  18.  
  19. addUser.onload = function ()
  20. {
  21. alert("Congratulations! Your account has been created!");
  22. window.location = "loginpage.html";
  23. }
  24.  
  25. addUser.send(JSON.stringify(user));
  26. console.log("I MADE IT :D");
  27. }
  28. </script>
  29. </head>
  30. <style>
  31. body {
  32. font-family: Arial, Helvetica, sans-serif;
  33. }
  34.  
  35. * {
  36. box-sizing: border-box
  37. }
  38.  
  39. /* Full-width input fields */
  40.  
  41. input[type=text],
  42. input[type=password] {
  43. width: 100%;
  44. padding: 15px;
  45. margin: 5px 0 22px 0;
  46. display: inline-block;
  47. border: none;
  48. background: #f1f1f1;
  49. }
  50.  
  51. input[type=text]:focus,
  52. input[type=password]:focus {
  53. background-color: #ddd;
  54. outline: none;
  55. }
  56.  
  57. hr {
  58. border: 1px solid #f1f1f1;
  59. margin-bottom: 25px;
  60. }
  61.  
  62. /* Set a style for all buttons */
  63.  
  64. button {
  65. background-color: #4CAF50;
  66. color: white;
  67. padding: 14px 20px;
  68. margin: 8px 0;
  69. border: none;
  70. cursor: pointer;
  71. width: 100%;
  72. opacity: 0.9;
  73. }
  74.  
  75. button:hover {
  76. opacity: 1;
  77. }
  78.  
  79. /* Extra styles for the cancel button */
  80.  
  81. .cancelbtn {
  82. padding: 14px 20px;
  83. background-color: #f44336;
  84. }
  85.  
  86. /* Float cancel and signup buttons and add an equal width */
  87.  
  88. .cancelbtn,
  89. .signupbtn {
  90. float: left;
  91. width: 50%;
  92. }
  93.  
  94. /* Add padding to container elements */
  95.  
  96. .container {
  97. padding: 16px;
  98. }
  99.  
  100. /* Clear floats */
  101.  
  102. .clearfix::after {
  103. content: "";
  104. clear: both;
  105. display: table;
  106. }
  107.  
  108. /* Change styles for cancel button and signup button on extra small screens */
  109.  
  110. @media screen and (max-width: 300px) {
  111. .cancelbtn,
  112. .signupbtn {
  113. width: 100%;
  114. }
  115. }
  116. </style>
  117.  
  118.  
  119. <body>
  120.  
  121. <form style="border:1px solid #ccc">
  122. <div class="container">
  123. <h1>Sign Up</h1>
  124. <p>Please fill in this form to create an account.</p>
  125. <hr>
  126.  
  127. <label for="username">
  128. <b>Username</b>
  129. </label>
  130. <input type="text" placeholder="Enter Username" id="username" required>
  131.  
  132. <label for="psw">
  133. <b>Password</b>
  134. </label>
  135. <input type="password" placeholder="Enter Password" id="password" required>
  136.  
  137. <div class="clearfix">
  138. <button type="button" class="cancelbtn">Cancel</button>
  139. <button type="submit" onclick="addUser()" class="signupbtn">Sign Up</button>
  140. </div>
  141. </div>
  142. </form>
  143.  
  144. </body>
  145.  
  146. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement