Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to play background sound js

<script>
  function play() {
  var audio = new Audio('https://interactive-examples.mdn.mozilla.net/media/examples/t-rex-roar.mp3');
  audio. play();
  }
</script>
<button onclick-"play();">PLAY MY AUDIO</button>
 
PREVIOUS NEXT
Tagged: #play #background #sound #js
ADD COMMENT
Topic
Name
2+1 =