Jump to content

Sound with image


Fire Dragon

Recommended Posts

I tried make image what creates sound when mouse is over it.I succeed create this kind code with one website's help:

<img src="Ganon.jpg" ONMOUSEOVER="document.all.music.src='pig.wav'"><bgsound src="pig.wav" id=music loop=2 autostart="false">

Problem is,that this works only with IE,and it plays sound also when page loads.Is there samekind code for Fire Fox and other browsers,and how I can prevent that sound don't play when page is loaded?I tried change autostart to false,but it plays still.Thank you very much! :)

Link to comment
Share on other sites

Try this, only plays when you mouse over the image, <embed> supported by IE & NN: http://www.w3schools.com/media/media_browsersounds.asp

<embed src="pig.wav" name="bgsound" autostart="false" loop="true" hidden="true"><img src="Ganon.jpg" onmouseover="javascript:document.bgsound.play()" onmouseout="javascript:document.bgsound.stop()" />

Link to comment
Share on other sites

I understood that code,and I saw this before too,but it won't work my Fire Fox 1.5,IE 6.0 or Opera 8.5.Or then I do something wrong.However,I can't see any mistakes :)

As i said it only works in IE and NN, make sure it's poining to the correct sound file because IE definently works.For FF and Opera you will need to find a similar solution. :) Have a look at the link i pasted for the tutorials site, maybe you need to use <object> tag
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...