Definition and usage
<audio> tags define sounds, such as music or other audio streams.
Example code:
<audio src= "Someaudio.wav" >
Your browser does not support the audio tag.
</audio>
Hints and Notes
Tip: You can place text content between the start and end tags so that older browsers can display information that does not support that tag.
Property
Event method (temporarily not expanded)
Play () playback
Pause () pauses
Actual combat
JS Sample Code
<audio id= "audio" src= "No.mp3" > Tell you how many times, you just do not listen, so the low version of the browser is not replaced, what do you want to do? </audio><script type= "text/ JavaScript ">var audioele = document.getElementById (" audio "); Audioele.play (); // play Audioele.pause (); // Pause </script>
jquery Sample Code
<audio id= "audio" src= "No.mp3" > Tell you how many times, you just do not listen, so the low version of the browser is not replaced, what do you want to do? </audio><script type= "text/ JavaScript ">var audioele = $ (" #audio ") [0];audioele.play (); // play Audioele.pause (); // Pause </script>
Why does jquery need a 0? The JS operation obtains the audio object, the jquery selector obtains the jquery object, the 0 object is the corresponding node object. Therefore, it is not possible to use jquery objects directly, which needs to be supplemented with a bit of basic knowledge.
HTML5--Audio tag