Another Music Question

N

Nancee

I have read the previous posts on setting up a button so users can stop music
from playing... but I don't get it... and the posts are old - so I am hoping
someone new can help.

Despite so many of those opposed to music on a website, I have a client who
insists... but with that, now wants a button so people can choose to not
listen. Personally, I use the ol' mute button, but he would like an on/off
button on the screen for viewers to opt in or out of listening to the music.

On the same notion of music... is there a way to insert music so it
continually plays throughout the website, not by individual page? If people
open a page in a new window, two tracks are now playing.

Any suggestions?

Thanks in advance!
 
T

Trevor Lawrence

Reply in-line

Nancee said:
I have read the previous posts on setting up a button so users can stop
music
from playing... but I don't get it... and the posts are old - so I am
hoping
someone new can help.

Despite so many of those opposed to music on a website, I have a client
who
insists... but with that, now wants a button so people can choose to not
listen. Personally, I use the ol' mute button, but he would like an
on/off
button on the screen for viewers to opt in or out of listening to the
music.

Yes, it can be done

This is some HTML code
<div id="sound"></div>
<input type="button" value="Play/Stop
Music"
onclick="playSound()" title="Play/Stop Music" />

where the function playSound() is

function playSound(fname) {
if (!fname)
fname = "audio/minuet.mid"
var x = document.getElementById("sound")
x.innerHTML = (!x.innerHTML ) ? '<embed src="' + fname + '" loop=false
autostart=true hidden>' : ''
}

You would need to change the reference fname= "........" to be your own
music file
On the same notion of music... is there a way to insert music so it
continually plays throughout the website, not by individual page? If
people
open a page in a new window, two tracks are now playing.

The only way to do this is to frame the site, which is not recommended. If
you want to do this, I can probably show you how, but I stopped doing that
quite some time ago, so I would need to dredge my memory somewhat
 
R

Ronx

For the second question, a pop-up window is a good alternative to
frames. Play the music in a pop-up window opened by an on-load event in
the Home Page. Closing the window will stop the music playing. Also,
it will not annoy may users since most browsers nowadays block automatic
pop-ups like this :) But make sure your client's browser does not
block pop-ups.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top