/    Sign up×
Community /Pin to ProfileBookmark

Play multiple sound files in a sequence

Hi I am new to JavaScript. I am create a web page using VB.NET. There is multiple sound files in an array and I want to play then one after the other in sequence. But at the present only the last sound file is being played.

Here is the code

function PlayQuestion(soundfiles)
{
if (soundfiles.length>0)
{
soundArray =soundfiles.split(“,”)
counter =soundArray.length
for(i=0 ;i<counter ;i++)
{
if (navigator.appName==”Netscape”)
{
if (document.getElementById)
{

document.getElementById(“soundspan”).innerHTML=”<embed src=’Voice/”+soundArray[i]+”.wav’ hidden=true autostart=true loop=false>”;
thissound=document.getElementById(‘soundspan’);
}

}
else
{
if (document.all && document.getElementById)
{
document.getElementById(“soundeffect”).src=””
document.getElementById(“soundeffect”).src=soundArray[i]
}
}
}

}
}

Could some one please help me on this.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@achuchmanJun 21.2009 — I am looking to link sound files in a web page; however, I do not know how to code it.

I want to play a sequence of specific sound files on a page load, one right after the other.

I code mostly in PHP, and Java is foreign to me, but I can learn.

Thanks!
×

Success!

Help @Sajal spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...