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 4 of 4
  1. #1
    Regular Coder
    Join Date
    Dec 2005
    Location
    UK
    Posts
    207
    Thanks
    6
    Thanked 2 Times in 2 Posts

    mouseOver sound in firefox

    hi

    i have the following code which works fine in IE but nothing happens in firefox.

    Code:
    <html>
    <bgsound id="sound">
    <script>
    function PlaySound(url) {
    document.all.sound.src = url;
    }
    </script>
    
    <body>
    
    <a href="#"><img src="images/butters.jpg" onMouseOver="PlaySound('http://www.pacdv.com/sounds/sounds/sound38.mp3')" /></a>
    </body>
    </html>
    Any one know of any good ways to make sound work in firefox?

    ta

  • #2
    Banned
    Join Date
    May 2006
    Location
    England
    Posts
    664
    Thanks
    0
    Thanked 84 Times in 84 Posts
    Quote Originally Posted by many_tentacles
    hi

    i have the following code which works fine in IE but nothing happens in firefox.

    Code:
    <html>
    <bgsound id="sound">
    <script>
    function PlaySound(url) {
    document.all.sound.src = url;
    }
    </script>
    
    <body>
    
    <a href="#"><img src="images/butters.jpg" onMouseOver="PlaySound('http://www.pacdv.com/sounds/sounds/sound38.mp3')" /></a>
    </body>
    </html>
    Any one know of any good ways to make sound work in firefox?

    ta
    Try the code demonstrated here. It isn't widely tested yet, but may be of use:
    http://www.hotspot.freeserve.co.uk/ttdemo/

  • #3
    New Coder
    Join Date
    May 2011
    Posts
    21
    Thanks
    12
    Thanked 0 Times in 0 Posts
    I have tried this link and the mouse over sounds do not work in FireFox 4.

    I am developing a haunted forest web site and the client wants a scream.wav when the user hovers over a link. I have searched and searched and found nothing to make it work in FireFox.

    All help is greatly appreciated.

    Thanks

  • #4
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    'bgsound' is for IE only. Add an empty span to your page and then use the mouse-over to insert an embed-ded sound file to this span. The script should be within the <head> tag of your page:

    Code:
    <script type="text/javascript">
    function PlaySound(url) {
    	document.getElementById("sound").innerHTML="<embed src=\""+url+"\" hidden=\"true\" autostart=\"true\" loop=\"false\" />";
    }
    </script>
    
    // and the HTML:
    
    <body>
    <span id="sound"></span>
    <a href="#"><img src="images/butters.jpg" onMouseOver="PlaySound('http://www.pacdv.com/sounds/sounds/sound38.mp3')" /></a>
    
    </body>
    If it doesn't work it may be because you're using an mp3 file. Try it first with a simpler .wav file. Otherwise, you may need to confiugure FF to play mp3 files.

    Added: Yeah, works for me in IE, FF and Chrome
    Last edited by AndrewGSW; 05-11-2011 at 12:14 PM.
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS


  •  

    Posting Permissions

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