Trouble playing audio files in javascript array
<p>I'm trying to create a button which when clicked plays an audio file and then when it's clicked again plays the next file in my array. I get it to play but when I click it the second time it plays both the first file AND the second. When I press it the third time it plays the first, second and third. Seems like I need to reset something or other to clear the first two tracks of the page. Here is what I have:</p>

<pre><code>    &lt;!DOCTYPE HTML&gt;
    &lt;html&gt;
    &lt;head&gt;
    &lt;/head&gt;
    &lt;body&gt;

    &lt;script language="javascript" type="text/javascript"&gt;

        audio = new Array('audio1.mp3','audio2.mp3','audio3.mp3');
        index = 0;

        function playSound() {
        if(index&lt;3){
        document.getElementById("start").innerHTML=document.getElementById("start").innerHTML +
        "&lt;embed src=\""+audio[index]+"\" hidden=\"true\" autostart=\"true\" loop=\"false\" /&gt;";
        index++;
        }
        else{ index = 0;
        document.getElementById("start").innerHTML=document.getElementById("start").innerHTML +
        "&lt;embed src=\""+audio[index]+"\" hidden=\"true\" autostart=\"true\" loop=\"false\" /&gt;";
        index++;
        }



    }

     &lt;/script&gt;

                &lt;button id="start" type = "button" onclick="playSound();"&gt;Start&lt;/button&gt;

    &lt;/body&gt;

&lt;/html&gt;
</code></pre>
