Advertisement
1xptolevitico69

Javascript create element Audio

Jan 18th, 2022
903
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 Audio</title>
  8.     <style>
  9.  
  10.       #audio {
  11.         width: 80%;
  12.         margin: auto;
  13.         display: block;
  14.         border: 5px solid red;
  15.         background-color: rgba(128,128,128,0.1);
  16.     }
  17.  
  18.  
  19. </style>
  20. </head>
  21. <body>
  22.  
  23.  
  24.   <script>
  25.  
  26.     audio = document.createElement('audio');
  27.     document.body.appendChild(audio);
  28.     audio.id = 'audio';
  29.     audio.loop = true;
  30.     audio.controls = true;
  31.     audio.src = 'https://1xpto.netlify.app/audio/bass.mp3';
  32.  
  33.  
  34. </script>
  35. </body>
  36. </html>
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement