Objective:
Every time you meet a problem, the thought is how to solve it? The best way is to query the network media, the better way is to let their memories, only their own understanding of the really belong to their own. To make an order reminder function, do not use audio-related plugins, although the plug-in countless, or like their own blind toss. (to some invisible link, said to have the effect of promotion, this article original website address:www.pushself.com)
Listen to a blog friend said that the weekend reading volume of the blog significantly decreased, the weekend good time does not go out to bubble sister's affirmation is nanyanzhiyin. Let's revisit the basic properties of the audio tag.
Definition and usage
<audio> tags define sounds, such as music or other audio streams.
Example code: < 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
Properties |
value |
Description |
AutoPlay |
AutoPlay |
If this property appears, the audio plays immediately when it is ready. |
Controls |
Controls |
If this property appears, the control is displayed to the user, such as the play button. |
Loop |
Loop |
If this property appears, the playback starts again each time the audio ends. |
Preload |
Preload |
If this property appears, the audio loads when the page loads and prepares to play. If you use "autoplay", the property is ignored. |
Src |
Url |
The URL of the audio to play. |
Event method (temporarily not expanded)
Play () playback
Pause () pauses
Actual combat, the code is only for the next imitation
JS Sample Code<AudioID= "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> <Scripttype= "Text/javascript"> varAudioele=document.getElementById ("Audio"); Audioele.play (); //PlayAudioele.pause (); //Pause </Script>
jquery Sample Code<AudioID= "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> <Scripttype= "Text/javascript"> varAudioele= $("#audio")[0]; Audioele.play (); //PlayAudioele.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. (to some invisible link, said to have the effect of promotion, this article original website address:www.pushself.com)