HTML 5 <audio> 標(biāo)簽
定義和用法
<audio> 標(biāo)簽定義聲音,比如音樂(lè)或其他音頻流。
HTML 4.01 與 HTML 5 之間的差異
<audio> 標(biāo)簽是 HTML 5 的新標(biāo)簽。
例子:
<audio src="someaudio.wav">您的瀏覽器不支持 audio 標(biāo)簽。</audio>
屬性
屬性 | 值 | 描述 |
---|---|---|
autoplay | true | false | 如果是 true,則音頻在就緒后馬上播放。 |
controls | true | false | 如果是 true,則向用戶顯示控件,比如播放按鈕。 |
end | numeric value | 定義播放器在音頻流中的何處停止播放。默認(rèn)地,聲音會(huì)播放到結(jié)尾。 |
loopend | numeric value | 定義在音頻流中循環(huán)播放停止的位置,默認(rèn)是 end 屬性的值。 |
loopstart | numeric value | 定義在音頻流中循環(huán)播放的開(kāi)始位置。默認(rèn)是 start 屬性的值。 |
playcount | numeric value | 定義音頻片斷播放多少次。默認(rèn)是 1。 |
src | url | 所播放音頻的 url。 |
start | numeric value | 定義播放器在音頻流中開(kāi)始播放的位置。默認(rèn)地,聲音在開(kāi)頭進(jìn)行播放。 |
標(biāo)準(zhǔn)屬性
class, contenteditable, contextmenu, dir, draggable, id, irrelevant, lang, ref, registrationmark, tabindex, template, title
如需完整的描述,請(qǐng)?jiān)L HTML 5 中標(biāo)準(zhǔn)屬性。
事件屬性
onabort, onbeforeunload, onblur, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onerror, onfocus, onkeydown, onkeypress, onkeyup, onload, onmessage, onmousedown, onmousemove, onmouseover, onmouseout, onmouseup, onmousewheel, onresize, onscroll, onselect, onsubmit, onunload
如需完整的描述,請(qǐng)?jiān)L HTML 5 中事件屬性。