Solved

controlling sound play

Posted on 1998-02-04
3
213 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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
The viewer will learn how to dynamically set the form action using jQuery.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

839 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