Solved

Javascript EvalSound onClick

Posted on 2007-11-26
3
919 Views
Last Modified: 2012-05-05
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.

0
Comment
Question by:psenn
  • 2
3 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 125 total points
ID: 20356088
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
 

Author Comment

by:psenn
ID: 20357647
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
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 20357671
I guess you need to convert the hyperlink to flash, but that might give accessibility issues
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question