title: Force Trigger event listner with button onclick
body: <p>Using below code to make basic audio background music player to play files in a folder. On open and after Play (either button or on scale), it plays a random file in the Music folder. When that file ends, it loads another random file and plays it, then continues to repeat the process.  The Question - Is it possible add a button onclick = (i.e. Next Song) to trigger the "ended" event and trigger the next song when clicked.  I think I need to add a music.stop() also. I'm just trying to force the playing song to end and have the loop load the next song.  It appears that the "ended" event is a read only event and can't be manually changed to a true.</p>
  
  <pre><code>    &lt;html&gt;  
  &lt;head&gt;
  &lt;body&gt; 
  &lt;!-- &lt;audio id="player" controls&gt;&lt;source src="music/0.mp3" type="audio/mp3"&gt;&lt;/audio&gt; --&gt;
  &lt;div align="center" id="soundtrack"&gt;  
  &lt;script&gt;
  var WhichSong="Music2/song"+(Math.floor(Math.random()*23))+".mp3"
  
  document.getElementById('soundtrack').innerHTML="&lt;audio controls id='player'&gt;&lt;source src=\"" + WhichSong + "\"&gt;&lt;/source&gt;Your browser does not support the audio element.&lt;/audio&gt;";
  
      var x = 0;
      var music = document.getElementById("player");
      music.addEventListener("ended", function() {
      x=x+1;
      music.src = "Music2/song"+(Math.floor(Math.random()*23))+".mp3";
      music.load();
      music.play();       
      });
      &lt;/script&gt;
      &lt;br/&gt;
    &lt;button onclick="document.getElementById('player').play()"&gt;Play Music&lt;/button&gt; 
    &lt;button onclick="document.getElementById('player').pause()"&gt;Pause Music&lt;/button&gt;
    &lt;button onclick="document.getElementById('player').muted=true"&gt;Mute&lt;/button&gt;
    &lt;button onclick="document.getElementById('player').muted=false"&gt;Un-mute&lt;/button&gt;
    &lt;button onclick="document.getElementById('player').volume += 0.1"&gt;Vol +&lt;/button&gt; 
    &lt;button onclick="document.getElementById('player').volume -= 0.1"&gt;Vol -&lt;/button&gt;
  
  &lt;/div&gt;  
  &lt;/body&gt;
  </code></pre>
  
  <p></p>