Fire Dragon Posted February 19, 2006 Share Posted February 19, 2006 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 More sharing options...
scott100 Posted February 19, 2006 Share Posted February 19, 2006 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 More sharing options...
Fire Dragon Posted February 20, 2006 Author Share Posted February 20, 2006 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 Link to comment Share on other sites More sharing options...
scott100 Posted February 20, 2006 Share Posted February 20, 2006 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 <{POST_SNAPBACK}> 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now