PDA

View Full Version : A Little Help For The HTML Illiterate



HotWaterDeath
Dec 15, 2004, 09:15 PM
Do any of you know how to code in a decent background song on a web page?

Any help would be appreciated.

VioletSkye
Dec 15, 2004, 11:00 PM
<SCRIPT TYPE="text/javascript">
<!--
var filename="NAME_OF_MUSIC_FILE.MID";
if (navigator.appName == "Microsoft Internet Explorer")
document.writeln ('<BGSOUND SRC="' + filename + '">');
else if (navigator.appName == "Netscape")
document.writeln ('<EMBED SRC="' + filename + '" AUTOSTART=TRUE WIDTH=144 HEIGHT=60>

');
// -->
</SCRIPT>
<NOSCRIPT>
<BGSOUND SRC="NAME_OF_MUSIC_FILE.MID">
</NOSCRIPT>


Just switch out NAME_OF_MUSIC_FILE.MID with the midi, wav, .aud, .mp3 etc. file you want to play. Thats the easiest, most compatible way to do it.

If you know a little flash, you can easily do something similiar (and make sure you add a button to turn the sound off in case it annoys the person visiting your webpage.)

<font size=-1>[ This Message was edited by: VioletSkye on 2004-12-15 20:19 ]</font>

Nai_Calus
Dec 15, 2004, 11:15 PM
Website tip #224,532: If you have a music file embedded in your page, first kill yourself, and then have an option to turn it ON if someone actually wants to listen to it. XP

VioletSkye
Dec 15, 2004, 11:24 PM
Note that Firefox users may need to install a plug-in to hear it. In those cases you may want to just embed it or even better create a small Flash file. As Ian pointed out, it is generally annoying to have music suddenly start blaring when you visit a site lol, so as I mentioned earlier, at least make sure to add a button to turn it off. :]

HotWaterDeath
Dec 16, 2004, 12:32 PM
You guys/gals are awesome.

Thanks for the walk-through VioletSkye.