title: How do I loop a random audio player when the audio has finished playing?
body: <p>I've been trying to figure out a way to make one song transition to the next, how would I go about this?</p>
  
  <p>I haven't tried much. I'm relatively inexperienced in Javascript so my attempts have generally been futile.</p>
  
  <pre><code>var numberOfSongs = 4
  var sound = new Array(numberOfSongs+1)
  sound[0]= "skytop.mp3"
  sound[1]= "ac.mp3"
  sound[2]= "forgotten.mp3"
  sound[3]= "miserable.mp3"
  
  
  function randomNumber(){
  var randomLooper = -1
  while (randomLooper &lt; 0 || randomLooper &gt; numberOfSongs || isNaN(randomLooper)){ randomLooper = parseInt(Math.random()*(numberOfSongs+1))
  }
  return randomLooper
  }
  var randomsub = randomNumber()
  var soundFile = sound[randomsub]
  document.write ('&lt;EMBED src= "' + soundFile + '" hidden=true type="audio/mpeg" autostart=true loop=true&gt;')
  </code></pre>
  
  <p>This is what I'm working with, any pointers would be much appreciated. </p>