Click to See Complete Forum and Search --> : background music


alessandra
10-17-2008, 02:30 PM
Hi,
I am building a website with 5 pages (5html file).
I want to have background music for all the 5 pages, so that when I navigate from one to the other the music keeps playing.
How do I do that? So far I can play music in the homepage where I have the code shown below.
thanks for your help.


in the head of the index.html file I have the following line:

<bgsound id="PlayMusic" loop="-1">

in the body a button to play/stop the music:

<input type="button" class="button" name="OnOffButton" value="Stop Music" onClick="OnOff()">

and an external .js file with the OnOff function:

PlayMusic.src="Beauty_of_Hip_Hop.mp3";
function OnOff() {
if (PlayMusic.src=="Beauty_of_Hip_Hop.mp3")
{
PlayMusic.src="music.mp3";
OnOffButton.value="Play Music";
} else {
PlayMusic.src="Beauty_of_Hip_Hop.mp3";
OnOffButton.value="Stop Music";
}
}

infinityspiral
10-30-2008, 03:51 PM
Well you could load up every new piece of content using ajax or build the entire site inside flash. Most background music annoys users no matter how cool it is