Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.66 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <title>My First Webpage</title>
  5.  
  6.         <style>
  7.             body {
  8.                 margin: 0px;
  9.             }  
  10.  
  11.             #header {
  12.                 height: 100px;
  13.                 background:#cccccc;
  14.                 padding: 50px;
  15.             }
  16.  
  17.             #header div {
  18.                 display: inline-block;
  19.                 vertical-align: middle;
  20.             }
  21.  
  22.             #logo-container {
  23.                 margin-right: 50px;
  24.             }
  25.  
  26.             #logo-container img {
  27.                 height: 100px;
  28.                 width:auto;
  29.             }
  30.  
  31.             #header-text-container h1 {
  32.                 font-family: "Helvetica";                  
  33.             }
  34.  
  35.             #banner {
  36.                 height: 720px;
  37.                 background-color: #000;
  38.                 text-align: center;
  39.             }
  40.  
  41.             #content {
  42.                 padding: 50px;
  43.                 min-height: 500px;
  44.             }          
  45.  
  46.             #footer {
  47.                 height: 100px;
  48.                 padding: 10px;
  49.                 background: #cccccc;
  50.             }
  51.  
  52.             #footer div {
  53.                 display: inline-block;
  54.                 width: 33%;
  55.             }
  56.  
  57.         </style>
  58.     </head>
  59.     <body>
  60.  
  61.         <div id="app"> <!-- main div -->
  62.  
  63.             <div id="header"> <!-- header -->
  64.                 <div id="logo-container">
  65.                     <img src="https://image.flaticon.com/icons/png/128/201/201565.png" />
  66.                 </div>
  67.                 <div id="header-text-container">
  68.                     <h1>Road to Success</h1>
  69.                 </div>
  70.             </div>
  71.  
  72.             <div id="banner"> <!-- banner -->
  73.                 <iframe width="1080" height="720" src="https://www.youtube.com/embed/ilyLX9f4hY8" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
  74.             </div>
  75.  
  76.             <div id="content"> <!-- content -->
  77.                 <div v-if = "comments.length >= 1">
  78.                     <div v-for="comment in comments">
  79.                         <p>
  80.                             <b>{{ comment.name }}</b>: {{ comment.message }}
  81.                             <a href="javscript:void(0);" v-on:click="deleteComment(comment.id)">X</a>
  82.                         </p>
  83.                     </div>
  84.                 </div>
  85.                 <div v-else>
  86.                     <p>No comments yet</p>
  87.                 </div>
  88.                 <hr>
  89.                 <h3>Add comment</h3>
  90.  
  91.                 <div>
  92.                     <input type="text" v-model="name" placeholder="Your name"/>
  93.                     <br/>
  94.                     <br/>
  95.                     <textarea v-model="message" placeholder="Your comment"></textarea>
  96.                     <br>
  97.                     <br/>
  98.                     <button v-on:click="postComment">Submit</button>
  99.                 </div>
  100.                 <hr>
  101.             </div>
  102.  
  103.             <div id="footer"> <!-- footer -->
  104.                 <div>
  105.                     <p class="text">
  106.                         Beginning place. Multiply moving divided darkness so, forth first male all, be one called dominion cattle have gathering man moveth.
  107.                     </p>
  108.                 </div>
  109.  
  110.                 <div>
  111.                     <p class="text">
  112.                         Light female open called. Make lights, there for forth unto there. Waters great air creepeth were can't one great night.
  113.                     </p>
  114.                 </div>
  115.  
  116.                 <div>
  117.                     <p class="text">
  118.                         You'll. From stars don't they're behold, fill gathered. After let bring gathered she'd for won't good. Male one face. Firmament.
  119.                     </p>
  120.                 </div>
  121.             </div>
  122.  
  123.  
  124.         </div>
  125.         <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  126.         <script>
  127.            
  128.             var app = new Vue({
  129.                 el: "#app",
  130.                 data: {
  131.                     comments: [],
  132.                     name: "",
  133.                     message: ""
  134.                 },
  135.                 methods: {
  136.                     getComments() {
  137.                         this.comments = localStorage.getItem("comments") ? JSON.parse(localStorage.getItem("comments")) : [];
  138.                         console.log(localStorage.getItem("comments"))
  139.                     },
  140.                     postComment() {
  141.                         this.comments.push({
  142.                             id: Date.now(),
  143.                             name: this.name,
  144.                             message: this.message
  145.                         });
  146.  
  147.                         localStorage.setItem("comments", JSON.stringify(this.comments));
  148.  
  149.                         this.name = "";
  150.                         this.message = "";
  151.                     },
  152.                     deleteComment(id) {
  153.                         var position = this.comments.map(function(comment){
  154.                             return comment.id
  155.                         }).indexOf(id);
  156.  
  157.                         this.comments.splice(position, 1);
  158.                         localStorage.setItem("comments", JSON.stringify(this.comments));
  159.                     }
  160.                 },
  161.                 mounted() {
  162.                     this.getComments();
  163.                 }
  164.             })
  165.  
  166.         </script>
  167.  
  168.     </body>
  169. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement