Solved

Javascript EvalSound onClick

Posted on 2007-11-26
3
905 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

770 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