Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is the tag for a sound event in wave form

Status
Not open for further replies.

Alt

Programmer
Apr 11, 1999
3
0
0
US
what is the tag for making a wave sound event when clicking on a link?
 
I don't know that you can do EXACTLY what you're wanting using pure HTML. To embed a wav sound, simply use the tag: &lt;embed src= width=150, height=80&gt; *you may have to mess with the dimensions on that, it's been a while since I last figured that out.<br>
An alternative, if you still want it to play when you click on a link woud be to use the following JavaScript-enhanced link (replace !!! with the URL of the document being linked to and replace ??? with the URL of your wav file):<br>
&lt;a href="#" onClick="document.writeln('&lt;embed src=??? autostart=true&gt;'); window.location='!!!';"&gt;Linked text/object here&lt;/a&gt;
 
<embed src = &quot;mysound.wav> Momin ho to bay taigh bhee lerta hay sipahee
 
Alt

The following code code will play a .wav file when the mouse passes over the link.

<EMBED SRC=&quot;welcom98.wav&quot; autostart=&quot;false&quot; hidden=&quot;true&quot;>

<SCRIPT language=&quot;JavaScript&quot;>
<!--
function playHome()
{
if (document.all)
[tab]{
[tab]document.all.sound.src = &quot;welcom98.wav&quot;;
[tab]}
}
//-->
</SCRIPT>

<bgsound id=&quot;sound&quot;>
<A HREF=&quot;#&quot; onMouseover=&quot;playHome()&quot;>LINK TEXT GOES HERE</A>

HTH

Chris [pc2]
 
Chris - did you place that <embed> in the <head>? I couldn't tell from your script, and was under the (perhaps mistaken) impression that it needed to be in the body...
 
Thanks Chris for the clarification. I use a similar script to the one you recommend, but have not used the <embed> tag, because when I tested it using NN on a Mac, it required the loading of a Quicktime plugin. I avoid using any scripts that force viewers to go out onto the web and download plugins, so did not use the <embed> tag (even though it worked perfectly in Windows). Admittedly that is probably too much caution, given the small percentage using NN on a Mac, but that's another thread.

I wish there was a way to use the <embed> tag (perhaps in conjunction with a js??) to get around that nasty &quot;Plugin Required&quot; alert. While I do not write js, and have tremendous respect for its flexibility, I continue to wonder why there is not a way to pre-load sound into its architecture. Seems like a major oversight, given the popularity of sound on websites....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top