Now that you've got a sound file, what do you do with it? Simple. HTML has everything you need to quickly add a file to your site. For example, this bit of HTML code:
<A HREF="tada.wav">A familiar tone</a> for Windows users.
Creates the following link:
A familiar tone for Windows users.
It's that easy.
You can even force a sound file to start the second someone hits your page. Navigator and Internet Explorer versions 2.0 and later handle background sounds differently, but you can easily add a couple of HTML tags that will handle both browsers. For example, the following code samples will play a background MIDI file whether the visitor is running Navigator or Internet Explorer.
<bgsound src="sample.wav">
<embed src="sample.wav" autostart=true hidden=true></embed>

<bgsound> tells Internet Explorer to start playing the sound file.
<embed> with the "autostart=true" and "hidden=true" commands tells Navigator to start playing the file immediately. You can find out more about HTML's <embed> tag at the Netscape site.
Keep your background sound files small so they'll download quickly. If you're considering a longer piece of background music, consider using a MIDI file. And do your site's visitors a favor by adding the <bgsound> and <embed> tags for sound files near the end of the code for your page. That way visitors will be able to look at your site while the sound file is loading in the background. Also, keep in mind that making people listen to sounds whenever they hit your page is considered poor etiquette by many Web users. Not only that, but Web servers can be set up to handle included sound files differently, and that could result in some visitors receiving an error message when they hit your site.
Your best bet? Use a link, and let the visitors decide whether they want to make some noise or not.

 
Source


Go to the BUILDER.COM home page.
Copyright © 1995-97 CNET, Inc. All rights reserved.

back