[Javascript] I need to add sound to a button!!
morne vermaak
mornevermaak at yahoo.com
Sun Jun 2 08:32:24 CDT 2002
Hello,
I know it is kind of personal for me just to e mail you, but I really do need some help on a simple Javascript code, and I am sure that you can help me. I created a web site in Dreamweaver. I created my buttons by saving two separate GIFs and then I just did a simple rollover code in front of every button. It looks fine and it works perfectly. The only problem now is I would like to enter sound for every button. In other Words if the viewer clicks on the button, he must hear a simple sound efffect. Now getting the sound isnt my problem, I dont know how to add sound to that button!!! Here is my source code, can you check it out and maybe tell me how to put sound in for the buttons. I will REALLY, REALLY appreciate it!
Have a nice day!
Morne
Mornevermaak at yahoo.com
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body bgcolor="#000000" text="#000000" onLoad="MM_preloadImages('ABINUS/Buttons/bbmachines2.gif')">
<div align="center"><<<<<<this is where I would like the sound to be!!! If someone clicks on this button, the sound must play>>>>>>>>>><a href="APS2.gif" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image1','','bbmachines2.gif',1)"><img name="Image1" border="0" src="bbmachines1.gif" width="145" height="20"></a></div>
</body>
</html>
regards, mornevermaak at yahoo.com
---------------------------------
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20020602/25cf3fde/attachment.htm>
More information about the Javascript
mailing list