Advertisement
Guest User

Untitled

a guest
Oct 1st, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>JS List</title>
  5. <style>
  6. body, html {
  7. margin: 0;
  8. padding: 0;
  9. background-color: rgb(198, 198, 198);
  10. }
  11.  
  12. table {
  13. width: 100%;
  14. }
  15.  
  16. form.login-form {
  17. max-width: 400px;
  18. margin: auto;
  19. }
  20.  
  21. form.login-form h1 {
  22. text-align: center;
  23. font-size: 42px;
  24. font-family: Impact;
  25. }
  26.  
  27. form.login-form fieldset label {
  28. display: inline-block;
  29. width: 30%;
  30. }
  31. form.login-form fieldset input {
  32. display: inline-block;
  33. width: 65%;
  34. }
  35. form.login-form fieldset {
  36. text-align: center;
  37. }
  38. #login-button {
  39. display: block;
  40. margin: 20px auto;
  41. width: 40%;
  42. color: white;
  43. font-size: 24px;
  44. background-color: green;
  45. height: 50px;
  46. border: none;
  47. box-shadow: 1px 1px 4px black;
  48. }
  49.  
  50. #course-dropdown {
  51. display: block;
  52. width: 50%;
  53. margin: 5px;
  54. font-size: 24px;
  55. }
  56.  
  57. table tbody tr {
  58. display: block;
  59. width: 96%;
  60. padding: 2%;
  61. margin-top: 20px;
  62. background-color: white;
  63. box-shadow: 2px 2px 4px black;
  64. }
  65. table tr td {
  66. display: inline-block;
  67. width: 30%;
  68. }
  69. table tr th {
  70. display: inline-block;
  71. width: 30%;
  72. }
  73. </style>
  74. </head>
  75. <body>
  76. <form class="login-form">
  77. <h1>Tally-Ho</h1>
  78. <fieldset>
  79. <legend>Log Into Our App</legend>
  80. <label for="username">Username:</label>
  81. <input type="text" name="username" id="username">
  82. <br>
  83. <label for="password">Password:</label>
  84. <input type="password" name="password" id="password">
  85. <br>
  86. <label for="color">Security Color</label>
  87. <input type="color" name="color" id="color">
  88. </fieldset>
  89. </form>
  90. <button id="login-button" onclick="logIn()">Log In</button>
  91.  
  92. <select id="course-dropdown">
  93. <option value="107">CSIT 107</option>
  94. <option value="207">CSIT 207</option>
  95. <option value="307">CSIT 307</option>
  96. </select>
  97. <hr>
  98. <aside id="sidebar">
  99. <h4>Top Course</h4>
  100. <ol>
  101. <li>107 (65)</li>
  102. <li>207 (34)</li>
  103. <li>307 (26)</li>
  104. </ol>
  105. </aside>
  106. <table>
  107. <thead>
  108. <tr>
  109. <th>Department</th>
  110. <th>Number</th>
  111. <th>Name</th>
  112. </tr>
  113. </thead>
  114. <tbody>
  115. <tr>
  116. <td>CSIT</td>
  117. <td>307</td>
  118. <td>Mobile Aesthetic Design</td>
  119. </tr>
  120. </tbody>
  121. </table>
  122.  
  123.  
  124. <script type="text/javascript">
  125. // Hide the List!
  126. document.querySelector('table').style.display = 'none';
  127. document.querySelector('#course-dropdown').style.display = 'none';
  128.  
  129. // Show the list on login
  130. function logIn() {
  131. document.querySelector('table').style.display = 'table';
  132. document.querySelector('#course-dropdown').style.display = 'block';
  133. document.querySelector('form').style.display = 'none';
  134. document.querySelector('#login-button').style.display = 'none';
  135. }
  136.  
  137.  
  138.  
  139.  
  140. // alert('HEYYYYYY YOUOUUU GUYYYSSSSSSSS');
  141. var courses = [{
  142. name: 'Web Programming I',
  143. number: '107',
  144. dept: 'CSIT'
  145. }, {
  146. name: 'Web Programming 2',
  147. number: '207',
  148. dept: 'CSIT'
  149. }];
  150.  
  151. courses.forEach(course => {
  152. var tbody = document.querySelector('tbody');
  153. tbody.innerHTML += `
  154. <tr>
  155. <td>${course.dept}</td>
  156. <td>${course.number}</td>
  157. <td>${course.name}</td>
  158. </tr>
  159. `;
  160. });
  161. </script>
  162. </body>
  163. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement