Unofficial Tips and Tutorials for Homestead SiteBuilder™ Users  
Background Music Script
by JK at JavaScript Kit
Home - Tips & Tutorials - JavaScript Demos - Java Applet Demos - Resources - Search - Contact
Playing: "White Bird" originally by It's A Beautiful Day, amateur interpretation from IfniMIDI. If you do not hear it, make sure your speakers are turned on. Known to work in IE, NS, and Firefox 1.0.1

Although SiteBuilder comes with a sound element that you can use to play background music on your web page, some members have been having problems with it. This is an alternative to the sound element and to the standard HTML code for background sound.

Copy-and-paste from <script> to </script> into an Insert HTML element and place anywhere on your web page. Be sure you change the musicsrc tag to your full URL (in red type) where your MIDI file is located:

<script>
<!--
/*
Background music script
By JavaScript Kit (http://javascriptkit.com)
Over 400+ free scripts here!
*/

//specify FULL path to midi
var musicsrc="http://yoursite.homestead.com/files/music.mid"
if (navigator.appName=="Microsoft Internet Explorer")
document.write('<bgsound src='+'"'+musicsrc+'"'+' loop="infinite">')
else
document.write('<embed src=\"'+musicsrc+'\" hidden="true" border="0" width="20" height="20" autostart="true" loop="true">')
//-->
</script>

Notes:

On this line, document.write('<bgsound src='+'"'+musicsrc+'"'+' loop="infinite">'), if you don't want the music to loop forever (and annoy your visitors) change "infinite" to "1".

On this line, document.write('<embed src=\"'+musicsrc+'\" hidden="true" border="0" width="20" height="20" autostart="true" loop="true">'), if you, again, don't want the music to keep playing on and on, change loop="true" to loop="false".

In order for your visitors to hear the music, they must have a full install of the browser which includes a MIDI plug-in. This applies to both IE and Netscape.

For more info about embedding sounds, including why it's difficult to use MP3s, see this page at CNet's Builder.com written by Sarahjane White.



Click window close to return to main Scripts page or click here.


Home - Tips & Tutorials - JavaScript Demos - Java Applet Demos - Resources - Search - Contact
Webpage graphics by Arride Graphics

Copyright © 2000-2004 The Rambling Tutor and JanetS  All Rights Reserved
All other copyrights and trademarks are the property of their respective owners.

Hosted by www.Geocities.ws

1