Forum Moderators: not2easy
im trying to get the hover sound to work...
this is my current code - im totally lost im not sure how to put my code in!
<STYLE>
<!--BODY {background: #C6CEFF no-repeat;}td { font-family: verdana; font-size: 9pt; }p
{ font-family: verdana; font-size: 9pt; }.nav {color: #000000; text-decoration: none }.nav2
{color: #000000; text-decoration: none ; border-bottom: #000000; border-width: 1px 1px 1px
1px; border-style: dotted dotted dotted dotted;}A:hover { color: #FF4200; text-decoration:
none; }-->
</STYLE>
i changed my sound file to the "au format" but i need some serious help making it work!
THANKS IN ADVANCED!
<STYLE>
<!--BODY {background: #C6CEFF no-repeat;}td { font-family: verdana; font-size: 9pt; }p
{ font-family: verdana; font-size: 9pt; }.nav {color: #000000; text-decoration: none }.nav2
{color: #000000; text-decoration: none ; border-bottom: #000000; border-width: 1px 1px 1px
1px; border-style: dotted dotted dotted dotted;}A:hover { color: #FF4200; text-decoration: none; cue-after: url("beep.au");}-->
</STYLE>
If that doesn't help, perhaps this CSS-Aural reference [w3schools.com] will.
The "cue-after" is only for aural browsers (for the visually impaired).
-----
Without CSS, but with some JavaScript, I got it working (on IE that is; I'm not sure 'bout other browsers)
<a href="http://www.something.org/" onMouseOver="hoversound.play()">test hover sound</a>
<embed name="hoversound" src="gong.wav" autostart="false" loop="false" volume="150" hidden="true" />
If the duration of the sound is too long, you can add
onMouseOut="hoversound.stop()"
<John DeVie />
oneee more question pls!
this is my code
<TR><TD WIDTH=200 BGCOLOR="#C6CEFF"> <center><a class=naw href="main.htm" target="main">
<B>Main</a></B></TD></TR></center>
Where do i fit your code in?
does it work with the "au format"? coz apparently from some site i was looking at, to make a hover work u need to change the format to "AU" is that correct?
sorry im sooo slow!
ehehe :)
<a class=naw href="main.htm" target="main" onMouseOver="hoversound.play()">
The <embed>-tag can go anywhere in the body, since it doesn't show to the users (hidden="true").
As for the sound format...
WAV DOES work. And surely it must work with any AU-file as with any WAV-file. The only problem is when a user doesn't have an application installed that can play that specific format of sound file. He or she does not hear the hover sound.
I, for instance, can not play AU-files.
WAV and MP3 are much better 'covered' worldwide than AU.
<John DeVie />
but its still not working!
<embed name="hoversound" src="hov.wav" autostart="false" loop="true" volume="150" hidden="true" />
if i change the above code to autostart="true"
it does make the noise But i didnt mouse over on the link!
whats going on?
I did change the format from AU to WAV.
Thank you soo much!
I can't get the play() method to work either (I also tried Play(), play(false), play(true), run(), Run(), and various others that I find from Googling -- none of them worked for me). I think it might be because I have QuickTime installed and associated with wav files. In any case I played around with a DOM2 way of doing it by just creating and inserting the embed element itself on mouseover, then stopping and destroying it with a timer. I'm not sure if this will work for your purposes but here is what I came up with.
In the head of the document:
<script type="text/javascript">
<!--
var tmr = null, ebd = null;
function makeSound(file) {
if (!ebd) {
var snd = document.createElement('embed');
snd.setAttribute("name", "hoversound");
snd.setAttribute("id", "hoversound");
snd.setAttribute("src", file);
snd.setAttribute("autostart", "true");
snd.setAttribute("loop", "true");
snd.setAttribute("volume", "150");
snd.setAttribute("hidden", "true");
document.getElementById("sound-holder").parentNode.appendChild(snd);
if (tmr) {
clearTimeout(tmr);
}
tmr = setTimeout('killSound()', 2000);
ebd = true;
}
else {
clearTimeout(tmr);
killSound();
return makeSound(file);
}
}
function killSound() {
document.getElementById("sound-holder").parentNode
.removeChild(document.embeds['hoversound']);
ebd = null;
}
//-->
</script>
* Increase the 2000 in the line
tmr = setTimeout('killSound()', 2000); to make it loop longer (2000 = 2 seconds). In the body:
<span id="sound-holder">
<a href="http://www.something.org/" onMouseOver="makeSound('hov1.wav');">test hover sound</a><br />
<a href="http://www.something.org/" onMouseOver="makeSound('hov2.wav');">test another hover sound</a>
</span>
Somewhat kludgy...but I was bored and mabye it will be useful to someone, somewhere, sometime... :)
Jordan
But that doesnt work for me either.... :(
i am using IE... i dont know why its not working!
another problem tho.
i have some background music on this site im making and some people can hear it and some people cant hear any music at all. they say its not running slowly they just dont hear nething.
What could be the problem?