View Full Version : Stop sound script?
07-29-2002, 05:48 AM
I am working in Dreamweaver and I have embeded a sound to play when the page loads. I want to use an image as a button to allow the user to stop the sound. Is this possible? Would it be easier to just use java for the whole sound load/sound stop business?
Sorry to ask such a simple question, this is much easier in Flash with the stop sound command.
07-29-2002, 08:36 AM
i downloaded this script somewhere...
Add this script to you page at the bottom right before the closing body tag:
(document.all) ? snd.src=document.embeds[x].src : document.embeds[x].play()
(document.all) ? snd.src="" : document.embeds[x].stop()
var audioStr='<bgsound id="snd" />\n'
for (var i in audio)
audioStr+='<embed name="audio'+ i +'" src="'+ audio[i] +'" autostart="false" hidden="true" />\n'
Then your links would look like this:
<a href="stuff.htm" onmouseover="playSound(1)" onmouseout="stopSound(1)">stuff</A>
with the above example you would hear sound2.wav whent he mose moves over the link and will stop when it moves out.
To have more than the two sounds add all the sounds you want to choose from here:
Just put as many songs in there as you like an remeber that they go in order like this:
so with the above example if my link said:
playSound(3) it would play moresongs.wav
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.