Advertisement
1xptolevitico69

Javascript create element Video

Jan 18th, 2022
1,016
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.76 KB | None | 0 0
  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 Video</title>
  8.     <style>
  9.  
  10.       #vid {
  11.         width: 80%;
  12.         margin: auto;
  13.         display: block;
  14.         border: 5px solid red;
  15.         padding: 5px;
  16.     }
  17.  
  18.  
  19. </style>
  20. </head>
  21. <body>
  22.  
  23.  
  24.   <script>
  25.  
  26.     video = document.createElement('video');
  27.     document.body.appendChild(video);
  28.     video.id = 'vid';
  29.     video.autoplay = true;
  30.     video.muted = true;
  31.     video.loop = true;
  32.     video.controls = true;
  33.     video.src = 'https://1xpto.netlify.app/video/jungle.mp4';
  34.  
  35.  
  36. </script>
  37. </body>
  38. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement