Click to See Complete Forum and Search --> : onMouseOver with sound?
Chewbubba
03-31-2003, 10:09 PM
I've been asked by a friend of my wife to develop a webpage (possibly the whole site) for a community of folks that are visually impaired. This is going to be a freebee job, but I'd like to do it well. I know a little javascript, but not much.
Anyway, here's the question: Is it possible to use the onMouseOver command to play audio instead of switching graphics or text?
Yah, sure...
<html><head>
<script>
function play(){
song.src="thefile.mp3"
}
</script>
</head><body>
<a href"somewhere.com" onMouseOver="play()">Play</a>
<embed id="song"></embed>
</body></html>
You can also do onmouseout="stop()"
And function stop(){song.src=""}
Oh, and this will only work in browsers that support getElementById(). If the above doesn't work for you, set a variable: "Song" (nottice the caps) to equal document.getElementById("song"); and then Song.src="thesong.mp3"
Try this link:
http://www.superprodesign.com/spd/scripts/sounds/swapp4.html
If you like, go to
http://www.superprodesign.com/spd/scripts/scripts.html
and look under the sound category if it is not exactly what you like.
Enjoy!!!
SPD
:D
Chewbubba
04-01-2003, 08:59 PM
Thanks, folks!
I'll check 'em out straight away!