Solved

Javascript EvalSound onClick

Posted on 2007-11-26
3
923 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
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…

751 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