'bgsound' plays a sound while the user visits the page : bgsound : Basic Tags HTML CSS TUTORIALS


HTML CSS TUTORIALS » Basic Tags » bgsound »

 

'bgsound' plays a sound while the user visits the page



    

<html>
   <head>
      <title>bgsound element example</title>
      <bgsound src="yoursoundfile.wav" loop="3">
      <script language="javascript">
          function stopSound() {
               document.all.tags("bgsound")[0].volume = -10000
          
          function restartStop() {
               document.all.tags("bgsound")[0].volume = 0;
          
      </script>
   </head>
   <body>
   Please use your own wav file to test the code.
   <br><br><br><br><br><br>
   
   <button type="button" onClick="stopSound()">Stop the music</button>
   <br>
   <button type="button" onClick="restartStop()">Restart the music</button> 
</body>
</html>
           
      
      



HTML code for linking to this page:

Follow Navioo On Twitter

HTML CSS TUTORIALS

 Navioo Basic Tags
» bgsound