The first contact HTML5, need to use music play Audio function, in how to control Audio through the onclick event playback and pause on a number of information, through the "HTML5 Learning Series Audio (1)" and "HTML5 audio/video tags, attributes, Methods, summary of Events Two blog learning, try to find the "HTML5 Learning Series Audio (1)" mentioned in the P.load ();p. Play () is invalidated in jquery, P.stop (); Then try the "HTML5 audio/video tags, attributes, methods, events summary" Given the Audio method and properties, in JS Play (), pause () two methods to control playback and pause, the following is jquery and JS code:
jquery Code:
$ (function () {
$ (. stop). Click (function () {
audio.bind (' Audio ', Stop ());
});
$ (". Play"). Click (function () {
audio.bind (' Audio ', Play ()); Invalid
});
JS Code:
<script>
Function Change () {Play
= document.getElementById ("audio");
if (document.getElementById (' play '). classname== "Stop") {
play.pause ();
document.getElementById (' Play '). Classname= "Play";
} else{
Play.play ();
document.getElementById (' Play '). Classname= "Stop";
}
</script>