How do I get sound to play once by clicking on a hyperlink

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have added a voice intro on the index page and selected it to be activated
with a double mouse click. In 'Preview' the result acts like a 'Mouseover';
anywhere on the index page the mouse is placed the dialogue begins.

What am I doing wrong?
 
Minerb17 said:
I have added a voice intro on the index page and selected it to be
activated with a double mouse click. In 'Preview' the result acts
like a 'Mouseover'; anywhere on the index page the mouse is placed
the dialogue begins.

What am I doing wrong?


Try this
<span id="sound"></span>
<input type="button" value="Play/Stop
Music" onclick="playSound()"/>

where
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>' : ''
}

This will only play when clicked.
 
Back
Top