How do you add links to preview audio samples

G

Guest

I'm having a little difficulty getting my design to hyperlink and play an
audio sample. Any help is very greatly appreciated. Thanks.
 
T

Trevor L.

Hi Brandy,
I don't know whether this will help or not.

I am having trouble playing audio also, but I can get this to work in IE6.

In the HTML
<bgsound src="#" id="sound" loop=false autostart=true>
<input type="button" value="Play
Music" onClick="playSound()">
<input type="button" value="Stop
Music" onClick="stopSound()">

In JS
function playSound()
{ document.getElementById("sound").src = "minuet.wav"}
function stopSound()
{ document.getElementById("sound").src = "" }

Clicking on "Play Music" starts the audio file "minuet.wav".
Clicking on "Stop Music" stops the file.

I only wish it would work in FireFox. I think I need an <embed> tag, but I
haven't succeeded yet.
 
S

Stefan B Rusynko

Don't use bgsound
Use an embed tag
<embed src="soundfilenamehere" id="sound" name="sound" loop=false autostart="true" width="0" height="0" hidden align="center">

- and wrap your input tags in a form tag
--




| Hi Brandy,
| I don't know whether this will help or not.
|
| I am having trouble playing audio also, but I can get this to work in IE6.
|
| In the HTML
| <bgsound src="#" id="sound" loop=false autostart=true>
| <input type="button" value="Play
Music" onClick="playSound()">
| <input type="button" value="Stop
Music" onClick="stopSound()">
|
| In JS
| function playSound()
| { document.getElementById("sound").src = "minuet.wav"}
| function stopSound()
| { document.getElementById("sound").src = "" }
|
| Clicking on "Play Music" starts the audio file "minuet.wav".
| Clicking on "Stop Music" stops the file.
|
| I only wish it would work in FireFox. I think I need an <embed> tag, but I
| haven't succeeded yet.
| --
| Cheers,
| Trevor L.
| Website: http://tandcl.homemail.com.au
|
| Brandy wrote:
| > I'm having a little difficulty getting my design to hyperlink and
| > play an audio sample. Any help is very greatly appreciated. Thanks.
|
|
 
T

Trevor L.

Thanks, SBR

I will try this on both IE6 and FF. I trust it will work on both - I assume
your reply answered my query - "I only wish it would work in FireFox"
 
T

Trevor L.

Well, this didn't work in Firefox or in IE6.

HTML:
<embed src="" id="sound" name="sound" loop=false autostart=true hidden>
.............
<input type="button" value="Play
Music" onClick="playSound()">
<input type="button" value="Stop
Music" onClick="stopSound()">

JS:
function playSound()
{ document.getElementById("sound").src = "minuet.wav"}
function stopSound()
{ document.getElementById("sound").src = "" }

I tried changing <input> to <button> and that failed in IE6 when using
<bgsound src="#" id="sound" loop=false autostart=true>
This (bgsound) works in IE6 with an <input> tag
 
A

Andrew Murray

I thought "embed" was the Netscape or non-IE browser equivalent of
"bgsound".
 
T

Trevor L.

Hi Andrew,

Yes, I am sure you are correct. What I found is that embed works in both IE6
and Firefox - although not as well in Firefox, strangely. (I couldn't set
its attributes, e.g. src=)

"bgsound" works in IE6, not in Firefox.

Firefox is non-IE but is it a version of Netscape?
I thought, being Mozilla, it was different again from both IE and Netscape.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top