• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 990
  • Last Modified:

Javascript EvalSound onClick

has a pretty good write-up on different methods to play sounds.
I like 4. Controlling an Embedded Sound using JavaScript (New) the best.

Q: What's the best method to play a sound when the user presses a hyperlink?
I don't want it to follow the hyperlink, so I know the function should return false.

  • 2
1 Solution
Michel PlungjanIT ExpertCommented:
Best way: Use flash!

To answer:

<a href="#" onClick="EvalSound('sound1'); return false"><img src="play.gif" border="0"></a>

or text:

<a href="#" onClick="EvalSound('sound1'); return false">Play</a>
psennAuthor Commented:
OK, thanks.
If Flash is the best way, how should I use it?
Convert the wav file to swf, or is it easier than that?
Michel PlungjanIT ExpertCommented:
I guess you need to convert the hyperlink to flash, but that might give accessibility issues
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now