You can try listening and pausing with a list of music you've recently worked on and click Audition. In fact, HTML5 implementation of this function is very simple.
Embed the outer chain of music in the Web page first
<ahref= "javascript:void (0);"onclick= "Music.changeclass (this, ' media ');"class= "Btn Btn-green"Data-id= "Edit_btn"Data-width= "The "Data-height= " the"Data-mask= "true"Data-title= "Audition">Try Listening</a><Audiopreload= "preload"src= "Http://www.baidu190.com/md5/043546aee51d1f85a0b871e8406750352e.mp3"ID= "Media"Hidden></Audio>
You can control the music playback (play ()) and Pause (Pause ()) by using the audio ID, and by changing the word on the button (my button is done with a tag), JS code (remember to introduce the jquery library):
// music play music = function (Target,id) { var htmlvalue =
$ (target). html ();
var ids = document.getElementById (ID); (Htmlvalue = = ' Audition ' ) ? Ids.play (): Ids.pause (); (Htmlvalue = = ' Audition ' ) ? $ (target). html ("pause" "audition"
Principle: JS First get the button (A-tag) object and audio object, and then judge the button's HTML () value to achieve the music pause and play. About implementing different buttons to listen to different music, let the audio ID be the primary key of the row data .
HTML5 playing and pausing music using the audio tag