PDA

View Full Version : Looking for a script



Xposure
07-31-2005, 07:06 PM
I want a script that generates a sound on mouse rollover ie.. mouse over
nav. buttons.

Is ther a script?

jscheuer1
07-31-2005, 08:10 PM
http://www.dynamicdrive.com/dynamicindex11/javascriptsound.htm

That's for IE only. I devised a script that works in Mozilla as well:

<html>
<head>
<title>Cross Browser Sound - Demo</title>
<style type="text/css">
.snd {
height:0;
width:0;
position:absolute;
top:0;
left:0
}
</style>
<script type="text/javascript">
/*Cross Browser Sound Script
Copyright John Davenport Scheuer
Permission granted for use
This credit must stay intact*/
//////////No need to Edit Script/////////
function e_sound(soundobj) {
if((!document.all)&&(document.getElementById)){
var thissound= eval("document."+soundobj);
thissound.Play();
}
else if(document.all){
var a=eval("document.all."+soundobj+".src");
document.all.sound.src=a;
}
else
return;
}
</script>
</head>
<body onfocus="if(document.all)document.all.sound.src=''">
<bgsound id="sound">
<!--edit below embeds to add different SRC sounds or add more,
use a unique name for each embed-->
<embed class="snd" NAME="chm" SRC="chimes.wav" AUTOSTART="false" loop="false" HIDDEN="true">
<embed class="snd" NAME="dng" SRC="ding.mp3" AUTOSTART="false" loop="false" HIDDEN="true">
<embed class="snd" NAME="thp" SRC="thup.wav" AUTOSTART="false" loop="false" HIDDEN="true">
<!--use with any element that supports onMouseOver, onMouseOut or onClick events-->
<span onmouseOver="e_sound('chm')" onmouseOut="e_sound('dng')">Mouse Over This for Chime, Mouse Out for Ding</span>
<br><a href=// onmouseOver=e_sound('thp')>Thup!</a>
</body>
</html>

Xposure
08-02-2005, 08:20 AM
Thanks John