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

Recent

Welcome to TinyPortal. Please login or sign up.

April 19, 2024, 05:48:47 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,164
  • Total Topics: 21,219
  • Online today: 266
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 153
  • Total: 153

Play a sound on mouseover a block

Started by nokonium, May 15, 2006, 08:06:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Nokonium

Sorry I just couldn't resist the temptationÃ,  >:D

Obviously you will need to substitute the file referencesÃ,  :2funny:


<div align="center"><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="OLgraphics/fart4.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('OLgraphics/fart4.wav')"><img src=OLgraphics/fartbutton3.gif align="center"/></a></div>


It's on my Fiddlers Elbow site

Nokonium

It works OK in IE, but not in FF or Opera. If I use embed instead of bgsound it doesn't work at all.


Xarcell

This is what I use to have a sound play in both browsers.


<SCRIPT language="JavaScript">

var MSIE=navigator.userAgent.indexOf("MSIE");
var NETS=navigator.userAgent.indexOf("Netscape");
var OPER=navigator.userAgent.indexOf("Opera");
if((MSIE>-1) || (OPER>-1)) {
document.write("<BGSOUND SRC=http://www.xarchology.com/sound/quiet.mp3 LOOP=5>");
} else {
document.write("<EMBED SRC=http://www.xarchology.com/sound/quiet.mp3 AUTOSTART=TRUE")
document.write(" HIDDEN=true VOLUME=200 LOOP=5>");
}
</SCRIPT>


I don't know if it is any help to you or not.

Crip

Java Applet would prolly work, but me don't like Applets..some is some out there..
I have become comfortably numb!

Cripzone | Crip's Free 2.0.2 Themes



Crip

need a bigger better fart than that little pudgy thing.. ;D
I have become comfortably numb!

Cripzone | Crip's Free 2.0.2 Themes



Crip

I have become comfortably numb!

Cripzone | Crip's Free 2.0.2 Themes



IchBin


Crip

I have become comfortably numb!

Cripzone | Crip's Free 2.0.2 Themes



G6Cad

Hm, did you forget that it was she that recorded this sound from you, and then shared it with Crip   >:D

IchBin

Har Har, you are not funny G6. Just for that comment I'm calling you G5 now... :P