| You are here : : Home > Free Resources > Dreamweaver Tutorials > Play Sound |
Basics
Featured Fireworks & Dreamweaver Template
|
Sample: Click Here to Play Sound
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
| <script language="JavaScript"> <!-- function MM_controlSound(x, _sndObj, sndFile) { //v3.0 var i, method = "", sndObj = eval(_sndObj); if (sndObj != null) { if (navigator.appName == 'Netscape') method = "play"; else { if (window.MM_WMP == null) { window.MM_WMP = false; for(i in sndObj) if (i == "ActiveMovie") { window.MM_WMP = true; break; } } if (window.MM_WMP) method = "play"; else if (sndObj.FileName) method = "run"; } } if (method) eval(_sndObj+"."+method+"()"); else window.location = sndFile; } //--> </script> |
| <embed name='CS1022563046202'
src='sound.wav' loop=false autostart=false MASTERSOUND hidden=true width=0 height=0> </embed> |
| <a href="#" onClick="MM_controlSound('play','document.CS1022563046202','sound.wav')">Click Here to Play Sound</a> |
Note: Make sure a sound file called 'sound.wav' is included in your local folder.
New! Dreamweaver Interactive Video Tutorials - Discover Everything You Need To Know To Build Your Website Step By Step From Start To Finish With This Dreamweaver Tutorial.
Click Here for more Dreamweaver learning resources!