View Full Version : CSS 2.0 sound on :hover ?

The Zodiac
12-02-2005, 08:25 AM
HI everyone, I posted a similar question in the javascript forums, as you can do this either way, but i for the life of me, cannot get a .wav sound to play on mouseover in firefox. I have tried javascript as well & the same thing, no sound in firefox. So if you have a suggestion on how i might get this to work, i would appreciate it greatly, as this is a must have effect for what i am trying to build. Thanks

12-02-2005, 08:56 AM
So because you were impatient you went ahead and broke the forum rules by cross posting. To do what you want the best solution would be to use flash but it can be done in javascript.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
#music {
<script type="text/javascript">
function PlayIt(what){
document.getElementById('music').innerHTML='<object width="1" height="1" '
+'classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" '
+'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" '
+'standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">'
+'<param name="url" value="'+what+'">'
+'<param name="uiMode" value="full">'
+'<param name="autoStart" value="true">'
+'<param name="loop" value="true">'
+'<embed type="application/x-mplayer2" '
+'pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" '
+'showcontrols="true" uimode="full" width="1" height="1" '
+'src="'+what+'" autostart="true" loop="true">'
function stopIt(){

<a href="somelink.html" onmouseover="PlayIt('http://urltoyoursong.mp3')" onmouseout="stopIt()">Play</a>
<div id="music">
<object width="1" height="1"
standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">
<param name="url" value="null.mp3">
<param name="uiMode" value="full">
<param name="autoStart" value="true">
<param name="loop" value="true">
<embed type="application/x-mplayer2"
showcontrols="1" uimode="full" width="1" height="1"
src="null.mp3" autostart="true" loop="true">