TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,966
  • Latest: safir45
Stats
  • Total Posts: 195,982
  • Total Topics: 21,320
  • Online today: 930
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 300
  • Total: 301
  • lurkalot

Add wave sound to a button?

Started by whoesa, May 14, 2006, 11:08:35 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bloc

Did you get the paths correct? Not having looked into it, that is many times the cause of trouble.

whoesa

Yes that could be the problem i have  :)

In fact im not 100% sure how exactle the code and the paths should look like. I only tried the code i found on that site and that didn't work or i edited wrong. (i think it will be that last  ;D)

Would it be possible to post an example of the code and the paths?

Thank you in advance.


G6Cad

Post it here and let some code master look at it :)

whoesa

lol ok, this is for the code master  ;D

<bgsound src="#" id="soundeffect" loop=1 autostart="true" />

<script type="text/javascript">

/***********************************************
* JavaScript Sound effect- ÂÃ,© Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/

var soundfile="sidebar.wav" //path to sound file, or pass in filename directly into playsound()

function playsound(soundfile){
if (document.all && document.getElementById){
document.getElementById("soundeffect").src="" //reset first in case of problems
document.getElementById("soundeffect").src=soundfile
}
}

function bindsound(tag, soundfile, masterElement){
if (!window.event) return
var source=event.srcElement
while (source!=masterElement && source.tagName!="HTML"){
if (source.tagName==tag.toUpperCase()){
playsound(soundfile)
break
}
source=source.parentElement
}
}

</script>


<a href="#" onMouseover="playsound(soundfile)">Example 1</a>

<a href="#" onMouseover="playsound('different.wav')">Example 2</a>



This website is proudly hosted on Crocweb Cloud Website Hosting.