View Full Version : How do i insert audio within a script if statement?
Big Stepper
12-17-2002, 01:20 AM
I'm trying to insert audio in a script. It's the roullete script where an alert comes up bang your dead. I want to make it where you also hear a gunshot, Can anyone help me with this? I keep getting errors when i try to do it. My website is under my profile. The script is on the games page....
function fireit(){
var theone=Math.floor(Math.random()*6)
if (theone<=document.fire.bullets.value-1)
alert("Bang. You\'re dead!")
else{
document.fire.message.value="Whew. Got lucky!"
setTimeout("document.fire.message.value='Play Roulette'",500)
}
}
Thanks,
Chris
Try This
function fireit(){
var theone=Math.floor(Math.random()*6)
if (theone<=document.fire.bullets.value-1)
me.play()
alert("Bang. You\'re dead!")
else{
document.fire.message.value="Whew. Got lucky!"
setTimeout("document.fire.message.value='Play Roulette'",500)
}
}
<EMBED id="me" SRC="bang.wav" loop=false autostart=false hidden=true mastersound>
Big Stepper
12-18-2002, 01:02 AM
Mr. J
Thanks for your reply.... I'm still getting errors... Is it because I've put the embed code within the script... shoul this be out of the script or within it?
Thanks,
Big Stepper
Place
<EMBED id="me" SRC="bang.wav" loop=false autostart=false hidden=true mastersound>
after the opening BODY tag.
Make sure that the path and name of the sound file is correct.
Big Stepper
12-19-2002, 12:12 AM
Mr. J ,
I' am successful. Although it was different than the way you advised...I certainly appreciate your input.... I put bgsound code at the beginning of the script....and repeated the if statement under the first one.... you can check out the results at yayodarecords.com , on the games page...
Thanks again,
Big Stepper
zoobie
12-19-2002, 01:52 AM
embed and mastersound are NS...although IE now supports embed as of 5.5
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.