|
-
May 12th, 2001, 02:11 PM
#1
Thread Starter
Addicted Member
On MouseOver/Click Play sound?
Hi, how can I play a sound when a user moves his/her mouse over a link on my website. I'm already using a ONMOUSEOVER for a rollover. Is it possible to add two ONMOUSEOVERs?
How can I play the sound when the link is clicked?
-
May 12th, 2001, 03:21 PM
#2
Fanatic Member
Script:
Code:
function playSound(SName)
{
if (document.embeds[SName] != null && document.embeds[SName].IsReady())
{
document.embeds[SName].play(false)
}
}
Link:
Code:
<a href="somewhere.html" onMouseOver="playSound('snd1');otherMouseOver()">
You also need to put this on your page:
Code:
<embed src="snd1.wav" name="snd1" hidden="true" loop="false" autostart="false">
Edit: Doesn't seem to work in IE, i got it from http://www.chalcedony.com/.
Alcohol & calculus don't mix.
Never drink & derive.
-
May 12th, 2001, 03:53 PM
#3
PowerPoster
IE 4+
Taken from http://www.javascriptcity.com
Code:
<EMBED SRC="sound_file_name.wav" autostart="false" hidden="true">
<SCRIPT language="JavaScript">
<!--
function playHome()
{
if (document.all)
{
document.all.sound.src = "sound_file_name.wav";
}
}
//-->
</SCRIPT>
<bgsound id="sound">
Put your mouse on the link to hear a sound
<A HREF="http://yoursite.com/page.html" onMouseover="playHome()">HERE</A>
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|