HTML/CSS/Basic Tags/bgsound

Материал из Web эксперт
Перейти к: навигация, поиск

"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>