View Full Version : Background music

06-20-2002, 10:09 PM
Hi everybody,
I have to embed a musical background to a web site. I have found a script, and they gave me the music file. Is there a simple way to have this music play for all the web pages continuously?
Thanks to all of you

Here is the script

var musicsrc="cosmic.mp3"
if (navigator.appName=="Microsoft Internet Explorer")
document.write('<bgsound src='+'"'+musicsrc+'"'+' loop="infinite">')
document.write('<embed src=\"'+musicsrc+'\" hidden="true" border="0" width="20" height="20" autostart="true" loop="true">')

06-21-2002, 12:01 AM
Does your site use frames?
If it does that would be cool because then you could just add that script to the frame that shoes all of the time. That would solve your problem. If not. I have no idea unless you popup a window and hope the people will not close it. That might be another Idea though. You could popup a window that has a play and stop button etc. Have fun!:thumbsup:

06-21-2002, 12:38 AM
Great idea, I did not think of frames!!
At least this solves half the problem. Thank you MikoLone

06-26-2002, 10:31 AM
The music script provided is very useful! Thanks!

I was wondering how to do two different modifications to this script:

1) Provide a toggle to turn the music on and off.

2) If NOT using frames, and the user turns the music off (or back on) on one page, then navigates to another page on the same site, what's the best way to have the user's last selected music play choice (i.e. off or on) take effect on the new page? Does this get into cookies? Or is there an easier way to track this?