首頁  >  文章  >  web前端  >  當瀏覽器正在取得HTML中的媒體資料時,執行一個腳本?

當瀏覽器正在取得HTML中的媒體資料時,執行一個腳本?

WBOY
WBOY轉載
2023-09-03 13:41:061037瀏覽

當瀏覽器正在取得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>

以上是當瀏覽器正在取得HTML中的媒體資料時,執行一個腳本?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:tutorialspoint.com。如有侵權,請聯絡admin@php.cn刪除