Click to See Complete Forum and Search --> : Timed sound delay...
Code One
07-11-2003, 03:18 AM
Hello,
I was wondering if someone could show me how to setup a Jscript which will delay a sound embeded in my web page. What I want to do is to have the page start and like 1 minute later a sound to play. I would appreciate any and all help from the forum.
Thanks
Code One
Gollum
07-11-2003, 06:21 AM
Have a look at the window.setTimeout() function. If you pass in a code string and a ms timeout, it will execute the code after the specified time.
e.g.
window.setTimeout("PlayItAgainSam();", 60000);
Code One
07-11-2003, 02:02 PM
My friend,
Thanks for responding. Hey I was wondering how do I reference this code in the body? Something like:
<body onload="playitagainsam()">
or
<embed src="" onload="playitagainsam()">
Anyhelp?
;)
Code One
Khalid Ali
07-11-2003, 02:04 PM
This lien seems correct
<body onload="playitagainsam()">
Code One
07-11-2003, 09:48 PM
How are you my friend? Good I hope, it's been a while since I seen you post to me. I always appreciate your help. You too forum.
Thanks guys,
Code One
Code One
07-11-2003, 10:00 PM
Hey guys Im a total dufus this past week, I think I am losing my head, and I can not do anything right it seems. So can someone please hold my hand on this one and show me how to setup this script. So far "anyideas" helped me out by scrapping me up this script:
<html>
<head>
<script>
function wait1minute()
{
//wait 1 minute = 60000
window.setTimeout("Play Sound", 60000);
}
</script>
</head>
<body onload="wait1minute()">
<embed src="mySong.wav" ?????????>
</body>
</html>
Now to you this is simple to me it is like duhhhhhhh. So please just show me how I would make the above script delay the embed src for the alloted time as is above as well.
Sorry to be so slow, ;)
Code One
Code One
07-12-2003, 01:44 PM
please review the above post and please allot me an answer if possible from anyone here. I am going mad trying to make this script work right and I am out of solutions, please if anyone can figure this out and post it for me that would be great.
Thanks guys,
Code One
<html>
<head>
<script>
function wait(){
setTimeout("document.getElementById('track').play()", 3000)
}
</script>
</head>
<body onload="wait()">
<EMBED id="track" SRC="yoursong.wav" loop=false autostart=false hidden=true mastersound></embed>
</body>
</html>
Code One
07-12-2003, 06:25 PM
Hey the script works great!!!
Thanks alot!
Code One