Advertisement
Guest User

swag

a guest
Nov 13th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>Notes</title>
  8. <link rel="stylesheet" href="style.css">
  9.  
  10. </head>
  11. <body>
  12. <div class="row">
  13. <div id="title"><h1>Sticky Notes</h1></div>
  14. </div>
  15. <div class="row">
  16. <input type="text" id="noteInput" placeholder="Enter your text here" size="70">
  17. <button class="noteSubmit" onclick="addNote()">Add a note</button>
  18. </div>
  19. <div id="noteContainer">
  20.  
  21. </div>
  22. <script src="notes.js"></script>
  23. </body>
  24. </html>
  25.  
  26. function addNote(){
  27. let userNote = document.createElement("div");
  28. userNote.className="userNote";
  29. let noteText = document.getElementById("noteInput").value;
  30. let n = document.createTextNode(noteText);
  31. userNote.appendChild(n);
  32. document.getElementById("noteContainer").appendChild(userNote);
  33. }
  34.  
  35. const notes = []
  36.  
  37. notes.push({
  38. title: 'first note',
  39. description: 'do something',
  40. pinned: true,
  41. color: 'green'
  42. })
  43.  
  44. notes.push({
  45. title: 'second note',
  46. description: 'do something else',
  47. pinned: true,
  48. color: 'yellow'
  49. })
  50.  
  51. notes.push({
  52. title: 'third note',
  53. description: 'do something else yet',
  54. pinned: false,
  55. color: 'green'
  56. })
  57.  
  58. localStorage.setItem('notes', JSON.stringify(notes))
  59.  
  60. body {
  61. background-color: rgb(0, 51, 102);
  62. color: white;
  63. }
  64.  
  65. .row {
  66. display:flex;
  67. justify-content: center;
  68. }
  69.  
  70. .noteContainer {
  71. display:flex;
  72. justify-content: center;
  73. }
  74.  
  75. .noteSubmit {
  76. background-color: #0080ff;
  77. padding: 1rem 1.5rem;
  78. border: none;
  79. }
  80.  
  81. .userNote {
  82. background-color: rgb(179, 217, 255);
  83. color: black;
  84. padding: 3rem 6rem;
  85. width: 20%;
  86. text-align: center;
  87. font-size: 5rem;
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement