I had a javascript function and it works well:
function playMp3(str) {
...
}
the other script:
function playMp3wholepage() {
var dgs=new Array();
dgs[0] = "/abc.mp3";
dgs[1] = "/dac.mp3";
dgs[2] = "/hf.mp3";
....
dgs[28] = "/er23.mp3";
dgs[29] = "/read/34_15.mp3";
for (i=0;i<=29;i++){
ses = dgs[i]
setTimeout("playMp3(ses);", 2000)
}
}
I want to play all of the sounds in the order that given in second script. but I could not get the second script run, it just play the last sound (dgs[29]), not all of them.
Thank you
When setTimeout callback execute,
secis alreadydgs[29], you need to create another function scope to perserve the value.