j0kStA
asked on
HTML Embed play() method
Hi Guys,
I am fairly advanced with JavaScript, but have been racking my brain with the most simple thing ever, HTML Embed. Basically, I'm trying to use the play() method to play a sound during a certain function. For some reason, it didn't work. So, I wrote a test doc to see if something else was interfering with it. The test doc contained the following code:
<HTML>
<head>
<script>
function EvalSound() {
document.getElementById('c hime').Pla y();
}
</script>
</head>
<body>
<embed src="http://members.aol.com/bufferm/wav/chime.wav" autostart=false hidden=true id="chime" name="chime">
<form>
<input type="button" value="Play Sound" onClick="EvalSound()">
</form>
<script>
EvalSound();
</script>
</body>
</HTML>
Pretty simple huh? The <script>EvalSound();</scri pt> by itself won't work, but when called from the onClick method, works just fine. Why will it play the sound from a button, but not when the function is called by itself?
I am fairly advanced with JavaScript, but have been racking my brain with the most simple thing ever, HTML Embed. Basically, I'm trying to use the play() method to play a sound during a certain function. For some reason, it didn't work. So, I wrote a test doc to see if something else was interfering with it. The test doc contained the following code:
<HTML>
<head>
<script>
function EvalSound() {
document.getElementById('c
}
</script>
</head>
<body>
<embed src="http://members.aol.com/bufferm/wav/chime.wav" autostart=false hidden=true id="chime" name="chime">
<form>
<input type="button" value="Play Sound" onClick="EvalSound()">
</form>
<script>
EvalSound();
</script>
</body>
</HTML>
Pretty simple huh? The <script>EvalSound();</scri
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Play() function is suppopted by IE only, so is this little sample :)
http://www.frozendev.com/temp/sequensial.htm
it chacks if audio file has been loaded and than playes.
http://www.frozendev.com/temp/sequensial.htm
it chacks if audio file has been loaded and than playes.
why not just autostart=true?
:)
:)
Why C? Please read http:help.jsp#hi73 and post a zero point question in http:Community_Support to review the grade.
Thanks a lot for the support Rod :)
No problem.
I agree, why C, but if you are looking for the perfect solution to this problem then my comment along with the sample is the one which was suppose to be assisted/accepted, but don't nobody think that I'm complainning about anything here,maybe asker was confused or didn't really understand the whole concept.
>> Play() function is suppopted by IE only
Works in Mozilla, FireFox and NS. Havn't tested in Opera yet...hang on.
Works in Mozilla, FireFox and NS. Havn't tested in Opera yet...hang on.
Stand corrected, I thought I had tested in all Gecko's. Nope in Opera.
> Works in Mozilla, FireFox and NS. Havn't tested in Opera yet...hang on.
never worked on my mozilla based browsers... are you sure you tested on mozilla, and not muzilla... :)
never worked on my mozilla based browsers... are you sure you tested on mozilla, and not muzilla... :)
it makes my point clearer if it works on mozilla based browsers.
Thanks PashaMod.
https://www.experts-exchange.com/questions/21533589/HTML-Embed.html