Help with outputs.

admin

Administrator
Staff member
I have used this code to try and play sounds with javascript, one after another, from a text area, in which you can type numbers. I thought that it would make them play one after another, with a 1 second gap. However, the first one plays fine, then all of the others play at the same time - not quite what I wanted!


function playLoaded() {
toPlay = document.getElementById("code").value;
// Gets individual Notes
notes = toPlay.split(" ");
// Plays notes
if (n < notes.length) {
v = notes[n];
n++;
window.setTimeout("playLoaded();",1000);
document.embeds[v].play();


}

}
 
Back
Top