title: Play mp3 file with javascript onClick
body: <p>I am playing mp3 file just javascript onClick.</p>
  
  <p>Bellow is my code:</p>
  
  <pre><code>//Music File 1
  &lt;audio id="id1" src="01.mp3"&gt;&lt;/audio&gt;
  &lt;button onClick="document.getElementById("id1").play()"&gt;Play&lt;/button&gt;
  &lt;button onClick="document.getElementById("id1").pause()"&gt;Stop&lt;/button&gt;
  
  //Music File 2
  &lt;audio id="id2" src="02.mp3"&gt;&lt;/audio&gt;
  &lt;button onClick="document.getElementById("id2").play()"&gt;Play&lt;/button&gt;
  &lt;button onClick="document.getElementById("id2").pause()"&gt;Stop&lt;/button&gt;
  </code></pre>
  
  <p>My question is, I am playing music 01.mp3 and I want it stop play if I press play button at music 02.mp3.</p>
  
  <p>Can any one give me a better solution than this? Totally, I want to way to play music like www.mp3skull.com, other stop play if pressed other file to play.</p>
  
  <p>Regards,
  Virak</p>