Solved

controlling sound play

Posted on 1998-02-04
3
207 Views
Last Modified: 2013-12-25
I want to put a small sound file on my Web site.  I want people to be able to click on a graphic or a button and then have the sound play in that instant.  Is there a way to set this up without any messy plugins?
0
Comment
Question by:transit
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
bigelos earned 100 total points
ID: 1857081
Sure!

Just use this code:
<EMBED SRC="test.wav" volume="100" hidden="true" autostart="false">

Then, for a link you would use:
<A HREF="#" onclick="document.embeds[0].play(false);">Play</a>

For a button you would use:
<INPUT TYPE=button VALUE="PLAY" onClick="document.embeds[0].play(false);">
0
 
LVL 3

Expert Comment

by:bigelos
ID: 1857082
For the document.embeds[X].play(false), X stands for the array number of your embedded source, 0 being the first element in the array.  The embedded sources array elements are number by the order in which they load.  So, if you have more than one sound, the command to play the second would be document.embeds[1].play(false).
0
 
LVL 1

Expert Comment

by:potsy
ID: 1857083
one thing is that the <EMBED> tag still requires a plugin (Well on some browsers it does)
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

867 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now