當指示 HTML 中的尋求已結束的 seeking 屬性設定為 false 時執行一個指令碼?


當用戶跳過或移動到音訊或影片中的新的位置時,onseeked 屬性會執行一個指令碼。

示例

你可以嘗試執行以下程式碼來實現 onseeked 屬性 −

<!DOCTYPE html>
<html>
   <body>
      <h2 id = "test">Play</h2>
      <video id = "myid" width = "320" height = "176" controls onseeked = "myFunction()">
         <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 myFunction() {
         document.getElementById("test").innerHTML = "Current position: " +
         document.getElementById("myid").currentTime;
         }
      </script>
   </body>
</html>

更新於: 03-Mar-2020

138 瀏覽量

開啟你的職業生涯

完成課程以獲取認證

開始
廣告
© . All rights reserved.