Although I briefly mentioned the Internet Explorer only BGSOUND tag before, here is the full form of that tag:
<BGSOUND SRC="filename.ext" LOOP="n">
There are many sound file formats that Windows (and Internet Explorer or Netscape) can play (depending on what the user installed). The main sound files are usually wave or midi (.wav or .mid extensions). Just remember that the above HTML tag will *ONLY* work for Internet Explorer and does NOT work for Netscape users. I'm only explaining it 'because it's there'.
If you leave out the LOOP option, the sound would play only once. You can specify how many times you want it to play be entering a number for "n". If you want the sound/music file to continuousely loop you can enter a minus one, or the word INFINITE for "n" as shown below:
<BGSOUND SRC="aintseen.mid" LOOP="-1"> <BGSOUND SRC="startrek.wav" LOOP="INFINITE">
I should mention that adding Sound/Music to your web pages is kind of tricky, and may not work at all for some users. Not only are there the differences in how various web browsers handle it, but it also depends on just what extra items (or plug-ins) the user may have installed. Plus, it also takes longer to download the extra sound/music file.
I play around with it on my web pages 'just because it's there' (kind of like why people climb mountains). I know it won't work for everbody, and there are even some people that it should work for and it doesn't. In fact, the odds of it working at all for most of your web page viewers is against you simply because most people do not install all the extra software, or up-grade their current software to handle it! I just thought I should warn you because, unlike the rest of the HTML code I have shown you, this sound stuff may not work. So you can't say I didn't warn you!
With all that in mind, the HTML code for adding sound used by Netscape has been fairly well standardised, and is somewhat supported in Internet Explorer. So here is how to do it the "Netscape way":
<EMBED SRC="file.ext" AUTOSTART="TRUE" WIDTH="145" HEIGHT="60" LOOP="FALSE">
With this layout, the sound will Autostart playing, and there will be a box displayed with Start, Stop, Pause buttons. The WIDTH and HEIGHT sizes shown are those recommended to be compatible with both Netscape and Internet Explorer. You can change AUTOSTART="TRUE" to AUTOSTART="FALSE" if you don't want the sound to automatically play, The user will then have to click on the Play button if he wants to hear it. Likewise, you can change the LOOP="FALSE" to LOOP="TRUE" if you want the sound to continuousely loop after it has started to play. You should also be able to enter a number (instead of TRUE or FALSE) here for how many times you want the sound to loop.
If you don't want a box to show up with the Start/Stop/Pause buttons you can try a value of 5 for the WIDTH and HEIGHT. This will still show a small square on the screen, but the user can not Start/Stop/Pause. (The value of 5 was reccomended in an article I found on the web, but zero also seems to work and makes the box totally disappear.)
The above seems to work nicely with Netscape 4.05, but there is a quirk about it when using Internet Explorer 4.01 SP1 (and probably also in Internet Explorer 3.x). If you place the above code further down on your web page (so the code for it, or box, does not show up on the screen until you scroll down to it) Internet Explorer will just sit there waiting as if the whole web page has not yet fully loaded. When you scroll down the screen to the point that the code/box is on your web page, then Internet Explorer will go back and finish downloading the sound file.
So the above will work with Internet Explorer (just a little weird). As such, you may find this quirk in Internet Explorer usefull if you don't want a sound to play until the user scrolls down the web page to that point (although I'm not sure if that is really usefull or not).
I won't run (play) an example music file on this web page because too many of my other web pages are already cluttered with music/sounds.