Play Sound on Mouseover or MouseClick in Dreamweaver
Play sound, music on Rollover, on Click or on Page Load using Dreamweaver Behaviors
Learn how to use Dreamweaver Behaviors to Play Sound in 2 quick steps
- The first step is to create a link for the sound to be played on Rollover or on Click. You can make a simple text link with the ‘#’ symbol.
- The next step is to add a behavior to the link. Open the Behaviors panel by clicking on Windows/Behaviors and click on the ‘+’ symbol in the Behaviors Panel. Click on ‘Play Sound’. Browse to find the sound you want to play and click on OK.
If you want the music to play on some other event, go back to the behaviors panel and in the events drop down menu choose another event e.g. If you want the music to play on Rollover then you have to choose onMouseOver
Dreamweaver also generates the following code that embeds the sound file within the page
<embed name='CS1022563046202' src='sound.wav' loop=false autostart=false MASTERSOUND hidden=true width=0 height=0> </embed>
This can be included towards the end of the page.
<a href="#" onClick="MM_controlSound('play','document.CS1022563046202','sound.wav')">Click Here to Play Sound</a>
e above code is taken from Macromedia Dreamweaver 4.0
Note: Make sure a sound file called ‘sound.wav’ is included in your local folder.