Click to See Complete Forum and Search --> : sounds on hover
I have this older JS that does not work for FireFox. I was wondering if there is a newer script available that works for all browsers that will preload and then play audio on a mouse over.
And I have found, NOT reload the page if accidentally clicked.
The description of what I am using is:
// Preload and play audio files with event handler (MouseOver sound)
// designed by JavaScript Archive, (c)1999
Thanx for any help!
RJ
abhayatweb
01-30-2007, 05:41 AM
Here is a code for playing sound on th page. It works with most browsers. But this is not "javascript". May be usefull for u. If u r not satisfied with this,then plz. repost ur question with full discription.
(sorry if too unsatisfactory)
<embed id="mySound" src="media/bjorn_spirits.mid" loop="false" autostart="true" hidden="true" width="100" height="100">
<button onclick="document.getElementById('mySound').play();"> <b>>></b> </button>
<button onclick="document.getElementById('mySound').stop();">
<b>||</b> </button>
</embed>
That helped me understand the process!
Let me be more specific. Forget hovering. Everyone clicks anyway and screws it all up! :)
I would like to embed (pre load) a few sounds on the page.
I would like them to play once and stop when a user clicks on an image.
A graphical control is not necessary but okay if need be.
I assume there has to be two parts.
The embed in the HEAD and the link at the graphic in the BODY?
DavidY
01-31-2007, 07:35 PM
The embed tags should be in the body anywhere before they are referenced. You can also use a JS call to play the sounds like this...
<body>
<EMBED SRC="test.wav" HIDDEN=TRUE AUTOSTART="false" MASTERSOUND NAME="test_sound">
<img onmouseover="javascript:document.test_sound.play()" src="img_01.gif" alt="" name="img_01" border="0" width="73" height="80">
</body>
The problem is that it doesn't seem to work in either Netscape or Firefox, at least not on my web page. I believe embedding sounds is not recommended by WC3, however.