Javascript EvalSound onClick

http://www.phon.ucl.ac.uk/home/mark/audio/play.htm
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.

psennAsked:
Who is Participating?
 
Michel PlungjanConnect With a Mentor IT 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>
0
 
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?
0
 
Michel PlungjanIT ExpertCommented:
I guess you need to convert the hyperlink to flash, but that might give accessibility issues
0
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.

All Courses

From novice to tech pro — start learning today.