Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CSS 2.0 sound on :hover ?

    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

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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.
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    <style type="text/css">
    #music {
    position:absolute;
    top:0;
    left:0;
    }
    </style>
    <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">'
    +'</object>';
    }
    function stopIt(){
    document.getElementById('music').innerHTML='';
    }
    </script>
    </head>
    
    <body>
    <a href="somelink.html" onmouseover="PlayIt('http://urltoyoursong.mp3')" onmouseout="stopIt()">Play</a>
    <div id="music">
    <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="null.mp3">
    <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="1" uimode="full" width="1" height="1"
    src="null.mp3" autostart="true" loop="true">
    </object>
    </div>
    </html>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •