Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-20-2002, 10:09 PM   PM User | #1
hrisula
New Coder

 
Join Date: Jun 2002
Location: Montreal
Posts: 80
Thanks: 0
Thanked 0 Times in 0 Posts
hrisula is an unknown quantity at this point
Background music

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
Hrisula

Here is the script

<script>
var musicsrc="cosmic.mp3"
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>
hrisula is offline   Reply With Quote
Old 06-21-2002, 12:01 AM   PM User | #2
MikoLone
Regular Coder

 
Join Date: Jun 2002
Location: Provo, UT
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
MikoLone is an unknown quantity at this point
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!
MikoLone is offline   Reply With Quote
Old 06-21-2002, 12:38 AM   PM User | #3
hrisula
New Coder

 
Join Date: Jun 2002
Location: Montreal
Posts: 80
Thanks: 0
Thanked 0 Times in 0 Posts
hrisula is an unknown quantity at this point
Great idea, I did not think of frames!!
At least this solves half the problem. Thank you MikoLone
Hrisula
hrisula is offline   Reply With Quote
Old 06-26-2002, 10:31 AM   PM User | #4
tommyf
New to the CF scene

 
Join Date: Jun 2002
Location: Santa Monica, CA
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
tommyf is an unknown quantity at this point
How to modify provided music script?

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?

Thanks!
tommyf is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:06 AM.


Advertisement
Log in to turn off these ads.