Advertisement
1xptolevitico69

Javascript create element Link

Jan 18th, 2022
715
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7.     <title>Javascript create element Link</title>
  8.     <style>
  9.  
  10.     .tube {
  11.       position: absolute;
  12.       top: 10px;
  13.       left: 10px;
  14.       background-color: red;
  15.       text-decoration: none;
  16.       text-align: center;
  17.       color: snow;
  18.       font-family: arial black;
  19.       padding: 5px 20px;
  20.     }
  21.  
  22.      .link {
  23.         position: absolute;
  24.         top: 100px;
  25.         font-size: 40px;
  26.         font-family: verdana;
  27.         text-decoration: none;
  28.         border-bottom: 5px solid red;
  29.     }
  30.  
  31.  
  32.  
  33. </style>
  34. </head>
  35. <body>
  36.  
  37.   <a class='tube' href='https://www.youtube.com/watch?v=UWWB-ggGPKA' target='_blank'>See it on YouTube</a>
  38.  
  39.  
  40.   <script>
  41.  
  42.     link = document.createElement('a');
  43.     document.body.appendChild(link);
  44.     link.innerHTML = 'Javascript create element link';
  45.     link.className = 'link';
  46.     link.href = 'https://www.youtube.com/watch?v=UWWB-ggGPKA';
  47.     link.target = '_blank';
  48.  
  49. </script>
  50. </body>
  51. </html>
  52.  
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement