Hey all,
I'm new to the forum and am stumped on a problem with playing a wav file using javascript and the embed tag.
Here are the basic lines of code
function playSound()
{
document.sound1.play();
}
<EMBED SRC="ding.wav" autostart=false HIDDEN=true NAME="sound1" MASTERSOUND>
<input type="button" onclick="playSound()">
When I click the button I get no sound.
The puzzling piece is this: When I change the EMBED tag to HIDDEN=false and then press the button, I get the sound. In other words, when the player is visible on the page, clicking the button works. When it's not visible, clicking the button produces no sound.
Would love to hear your thoughts!
Allen
I'm new to the forum and am stumped on a problem with playing a wav file using javascript and the embed tag.
Here are the basic lines of code
function playSound()
{
document.sound1.play();
}
<EMBED SRC="ding.wav" autostart=false HIDDEN=true NAME="sound1" MASTERSOUND>
<input type="button" onclick="playSound()">
When I click the button I get no sound.
The puzzling piece is this: When I change the EMBED tag to HIDDEN=false and then press the button, I get the sound. In other words, when the player is visible on the page, clicking the button works. When it's not visible, clicking the button produces no sound.
Would love to hear your thoughts!
Allen