/    Sign up×
Community /Pin to ProfileBookmark

mouseover sound help!

Hey guys, I need some help. I have divs placed in a html document, and what I need to do is have a sound play when a person is to hover their mouse over the,. I used this code that I’ve butchered together from researching on the internet, but it just isn’t working. The sound plays automatically as soon as the site loads. Can you please help me? Here is my code:

[CODE]<html>
<head>
<script>
function EvalSound(soundobj) {
var thissound= eval(“document.”+soundobj);
thissound.Play();
}
</script>

<embed src=”C.mp3″ autostart=false width=0 height=0 name=”C”
enablejavascript=”true”>
<embed src=”D.mp3″ autostart=false width=0 height=0 name=”D”
enablejavascript=”true”>

</head>
<link rel=”stylesheet” type=”text/css” href=”NavTest.css”>

<div id=red alt=”#” onMouseOver=”EvalSound(‘C’)”></div>
<div id=blue alt=”#” onMouseOver=”EvalSound(‘D’)”></div>
</html>[/CODE]

Thank you! [:

Sorry, maybe I should also mention that my knowledge of Javascript is NONE! ?

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @Beau spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...