Following are the steps to add sound to your web page using Dreamweaver 8.
Step 1
Create a link, this link can be to another page or otherwise you can use '#' symbol for simple text link.
Step 2
Open Behaviors window by clicking on Windows > Behaviors.
Step 3
Select the link text and click on "+" symbol in Behaviors window. Click on “Play Sound” and locate the file which you want to play and click on OK.
If you notice in Behaviors window the default event onClick is displayed, you can change it to onMouseOver, onMouseOut and so on as per the requirements.
Following the sample ways in which you can play the sound
Move your mouse over here to play the sound.
Following is the code generated by Dreamweaver 8.
JavaScript Code
<script type="text/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>
HTML Code
<EMBED NAME='CS1144732780609' SRC='eagle2.wav' LOOP=false AUTOSTART=false MASTERSOUND HIDDEN=true WIDTH=0 HEIGHT=0></EMBED>
Note: Make sure you have the sound file in the same location if you are using the above HTML code.
Code for the above link
<p class="tut">Move your mouse <a href="#" onmouseover="MM_controlSound('play', 'document.CS1144732780609', 'eagle2.wav')">over here</a> to play the sound.</p> |