Last updated: July 23, 2014.
BGSOUND TAG For this old tag, it would be best to drop its use and follow the directions on this page. Some versions of modern browsers no longer recognize this tag. EMBED TAG Now we'll consider the embed tag. Again, as above, please consider using the new form above. Let's start with the basic tag: If you use the embed tag by itself with no attributes added, a clickable button will appear. These words (in light green text) will appear above the button: Select to start. Clicking the button will produce the song. But suppose you want the sound to start automatically with no button showing? Then you must add these attributes: You may also add the loop attribute. Use a number, like "2" or "6". Finally, close this embed tag for sound. </embed> SOUND TAGS With the embed tag, you should also use the attribute called "hidden." Some versions of Internet Explorer will produce a pop-up control panel in the middle of the screen if you leave out the hidden attribute! So here's what you'll be putting on your page if you want viewers to hear music while they are reading your page:
A JAVASCRIPT CODE FOR SOUND FILES This uses JavaScript. Sometimes viewers have the JavaScript turned off in their browsers. So if you choose to use this JS solution, then it's a good idea to also put the following warning on your page: "If you hear no sound, reload, or enable JavaScript in your browser." Below is the JS in a text box ready for copying: WAV, AIFF & AU FILES Since we now have an online tool that will convert different file formats, rather than try to have the above formats which some browsers do not recognize, it's best to convert these files into mp3 files. Here's the converter. Lots of examples, including the various buttons, start, stop, etc; plus all the codes to copy. I haven't tried some of these codes, so don't know whether they'll all work for different browsers. JAVASCRIPT FOR VOLUME CONTROL In the onMouseOver line in the script, you can change the -50 to settings between that and +20 or so to increase the volume level. The above Javascript is from the Blue Fox's tutorial. MP3 playing is Jadai by M. Nakajima.
Tandem Tooters ~ ~ Flo's Music Pages |