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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

i would like to know if when you click on a button.......

Status
Not open for further replies.

gnibbles

Programmer
Mar 15, 2000
79
CA
i would like to know if when you click on a button if you can play a sound when it is clicked on.
 
Sure, just embed the sound into the document (<i>&lt;embed src=&quot;soundname.wav&quot; autoplay=&quot;false&quot; hidden=&quot;true&quot; name=&quot;thesound&quot;&gt;</i>). In JavaScript, when the mouse is click on (the attribute to the button being <i>onClick=&quot;somefunctionhere()&quot;</i>) where in the mouse will start playing (the JavaScript function would call <i>document.thesound.play=true</i>).<br>
<br>
I'm not sure these attributes are correct, you would need to look them up for the different plugins, but these usually work. They're almost universal. <p>REH<br><a href=mailto:hawkdogg@crosswinds.net>hawkdogg@crosswinds.net</a><br><a href= by Linux</a><br>Learn Linux and Leave out the Windows :)
 
didnt work though ive tried everything oh well thanks anyways
 
document.thesound.play=true<br>
<br>
this is where its complaining
 
Ok, what's the plugin that you are working with (you may want to detect for it)? You should then go the the plugin maker's web site and see if there is any information there. Netscape or MS won't help you because the attributes are plugin specific. Although I haven't used it in a long time, you could try &lt;bgsound src=&quot;blah.wav&quot;&gt; and see if you can find info on that. I couldn't, but perhaps you'll have better luck than I. <p>REH<br><a href=mailto:hawkdogg@crosswinds.net>hawkdogg@crosswinds.net</a><br><a href= by Linux</a><br>Learn Linux and Leave out the Windows :)
 
Just a thought:<br>
<br>
try document.thesound.play()<br>
<br>
<p>theEclipse<br><a href=mailto:eclipse_web@hotmail.com>eclipse_web@hotmail.com</a><br><a href=robacarp.webjump.com>robacarp.webjump.com</a><br>**-Trying to build a documentation of a Javascript DOM, crossbrowser, of course. E-mail me if you know of any little known events and/or methods, etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top