onMouseOver Help - Play music using onMouseOver command

They have: 5,633 posts

Joined: Jan 1970

Can anyone help me on how to change the following code? I've figured out how to play one music when your put your mouse over a link. Is there a way where I can have many links to play different music when you put your mouse over it's link?

<script language="JavaScript">
function playSound() {
document.all.sound.src = "http://www.wherever.com/whatever.mid"}
</script>
<bgsound id="sound"><A href="#" OnMouseOver="playSound()">Play Music</a>

John Pollock's picture

He has: 628 posts

Joined: Mar 1999

Perhaps you could send the function a parameter.. that being the url of the sound you want with each link, ie:

<script language="JavaScript">
function playSound(s_url)
{
document.all.sound.src = s_url;
}
</script>
<bgsound id="sound"><A href="#" OnMouseOver="playSound('http://wherever/file1.mid')">Play Music</a>
<P>
<A href="#" OnMouseOver="playSound('http://wherever/file2.mid')">Play More Music</a>

Smiling

They have: 7 posts

Joined: Jun 1999

I started a page nearly a year ago but never fully finished it. I modified a script I found somewhere. I used a separate button for each song but it sounds like you would like to show several songs on a pull down or pop up menu with an OnMouseOver and then select one to play. That shouldn't be too difficult either.
You're welcome to check out this code and use it if you like.
http://nanuq.com/mrbc/hymns.html

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.