HTML 中當媒體長度發生變化時執行一個指令碼?
ondurationchange 屬性可在 HTML 中音訊/影片的長度發生變化時觸發。
示例
你可以嘗試執行以下程式碼來實現 ondurationchange 屬性 -
<!DOCTYPE HTML>
<html>
<body>
<video width = "300" height = "200" controls ondurationchange = "display(this)">
<source src = "/html5/foo.ogg" type = "video/ogg" />
<source src = "/html5/foo.mp4" type = "video/mp4" />
Your browser does not support the video element.
</video>
<script>
function display(vLength) {
alert("Video Length: " + vLength.duration + " seconds");
}
</script>
</body>
</html>
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP