onpause 屬性在媒體暫停時觸發。您可以嘗試運行以下代碼來實現 onpause 屬性 –
示例
<!DOCTYPE html> <html> <body> <h2 id = "test">Play</h2> <video id = "myid" width = "320" height = "176" controls onpause = "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 = "Media paused!"; } </script> </body> </html>
登錄后復制
以上就是在HTML中,當媒體被用戶或程序暫停時執行腳本?的詳細內容,更多請關注www.92cms.cn其它相關文章!