当 seeking 属性设置为 true 时(表示 HTML 中正在执行定位功能),是否执行脚本?

htmlweb developmentfront end technology更新于 2026/1/16 8:12:17

使用 onseeking  属性在 HTML 中指示视频正在执行定位功能。

示例

您可以尝试运行以下代码,在 seeking 属性设置为 true 时(表示 HTML 中正在执行定位功能)执行脚本。 −

<!DOCTYPE html>
<html>
   <body>
      <video controls onseeking = "display()">
         <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() {
            alert("Seeking starts!");
         }
      </script>
   </body>
</html>

相关文章


有用资源