瀏覽器正在獲取 HTML 中的媒體資料時,執行指令碼?


使用 onprogress 屬性,可在瀏覽器正在獲取 HTML 中的媒體資料時執行指令碼。

示例

可以嘗試執行以下程式碼來實現 onprogress 屬性:

<!DOCTYPE html>
<html>
   <body>
      <video id = "myVideo" width = "320" height = "176" controls onprogress = "display()">
         <source src = "/html5/foo.ogg" type = "video/ogg" />
         <source src = "/html5/foo.mp4" type = "video/mp4" />
         Your browser does not support HTML5 video.
      </video>
      <script>
         function display() {
            alert("Started");
         }
      </script>
   </body>
</html>

更新於: 03-Mar-2020

75 次瀏覽

開啟你的 職業

透過完成課程取得認證

開始
廣告
© . All rights reserved.