Hi,
This code snippets will give you additional impact for your programs. If you mouse over the icon you can hear the sound.
<script LANGUAGE="JavaScript"><!-- // Preload and play audio files with event handler (MouseOver sound)
var aySound = new Array();
aySound[0] = "laser.wav";
document.write('<BGSOUND ID="auIEContainer">') IE = (navigator.appVersion.indexOf("MSIE")!=-1 && document.all)? 1:0; NS = (navigator.appName=="Netscape" && navigator.plugins["LiveAudio"])? 1:0; ver4 = IE||NS? 1:0; onload=auPreload;
function auPreload() { if (!ver4) return; if (NS) auEmb = new Layer(0,window); else { Str = "<DIV ID='auEmb' STYLE='position:absolute;'></DIV>"; document.body.insertAdjacentHTML("BeforeEnd",Str); } var Str = ''; for (i=0;iStr += "
Then You have to add the sound files in array for Preload actions:
aySound[0]="YourSoundFile.wav"; aySound[1]="AnotherSoundFile.wav"; aySound[2]="EvenAnotherOne.wav"; etc.,
Then you have to do the code with Event Handler, MouseOver/MouseOut
<A HREF="YourPage.html" onMouseOver="playSound(0)" onMouseOut="stopSound(0)">Move mouse over to play sound</A>
In OnClick Sound:
<A HREF="javascript:playSound(0);">Click here to play sound</A>
If you are performing operation by clicking the Buttons means,
<INPUT TYPE="BUTTON" VALUE="Click me!" onClick="playSound(0)">
|
No responses found. Be the first to respond and make money from revenue sharing program.
|