Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 2.02 KB | None | 0 0
  1. --HTML
  2.  
  3. <!DOCTYPE html>
  4. <html>
  5. <head>
  6.   <meta charset="utf-8">
  7.   <meta name="viewport" content="width=device-width">
  8.   <title>JS Bin</title>
  9.   <link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
  10. </head>
  11. <body>
  12. <header>
  13.     <img class="logo" src="https://images.unsplash.com/photo-1479722842840-c0a823bd0cd6?ixlib=rb-1.2.1&w=1000&q=80" height="399" width="600">
  14.     <h1 class="site-title">Christmas</h1>
  15.     <p class="site-description">Is coming</p>
  16.   </header>
  17.   <nav>
  18.     <ul>
  19.       <li><a href="https://www.calendar-12.com/holidays/christmas/2019">Christmas calendar</a></li>
  20.       <li><a href="https://en.wikipedia.org/wiki/Christmas">About Christmas</a></li>
  21.       <li><a href="https://www.timeanddate.com/holidays/common/christmas-day">Christmas day</a></li>
  22.       <li><a href="https://en.wikipedia.org/wiki/Santa_Claus">Santa Claus</a></li>
  23.     </ul>
  24.   </nav>
  25.   <main>
  26.     <section class="about-me">
  27.       <h1>About me</h1>
  28.       <img src="https://i.pinimg.com/originals/cb/d5/a2/cbd5a2bf6c01c249be35eeb3539fb5c7.jpg">
  29.       <p class="name">My name is Alex</p>
  30.       <p class="description">I like Christmas</p>
  31.     </section>
  32.     <section class="contact">
  33.       <h1>Contact</h1>
  34.       <form>
  35.         <label for="firstname">First name:</label>
  36.         <input id="firstname" type="text" name="firstname"><br>
  37.         <laber for="lastname">Last name:</label>
  38.         <input id="lastname" type="text" name="lastname">
  39.       </form>
  40.     </section>
  41.     <aside>
  42.       <h1>Clock:</h1>
  43.       <article class="clock">
  44.       </article>
  45.     </aside>
  46.   </main>
  47. </body>
  48. </html>
  49.  
  50. --JS
  51.  
  52. showClock();
  53. setInterval(showClock, 1000);
  54.  
  55. function showClock() {
  56.   //document.querySelector('.clock').innerText = new Date();
  57.   const date = new Date();
  58.   const h = date.getHours();
  59.   const m = date. getMinutes();
  60.   const s =  date.getSeconds();
  61.   if(s<10) {
  62.    time = h + ':' + m + ':' + '0' + s;
  63.  }
  64.  else {
  65.    time = h + ':' + m + ':' + s;
  66.  }
  67.  document.querySelector('.clock').innerText = time;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement