Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-27-2006, 02:42 PM   PM User | #1
many_tentacles
Regular Coder

 
Join Date: Dec 2005
Location: UK
Posts: 207
Thanks: 6
Thanked 2 Times in 2 Posts
many_tentacles is an unknown quantity at this point
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
many_tentacles is offline   Reply With Quote
Old 05-28-2006, 03:57 AM   PM User | #2
Arty Effem
Banned

 
Join Date: May 2006
Location: England
Posts: 664
Thanks: 0
Thanked 84 Times in 84 Posts
Arty Effem can only hope to improve
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/
Arty Effem is offline   Reply With Quote
Old 05-11-2011, 02:28 AM   PM User | #3
flashbang_pro
New Coder

 
Join Date: May 2011
Posts: 21
Thanks: 12
Thanked 0 Times in 0 Posts
flashbang_pro is an unknown quantity at this point
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
flashbang_pro is offline   Reply With Quote
Old 05-11-2011, 12:03 PM   PM User | #4
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
'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
__________________
"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

Last edited by AndrewGSW; 05-11-2011 at 12:14 PM..
AndrewGSW is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:09 AM.


Advertisement
Log in to turn off these ads.