使用 HTML 中的 onending 屬性在媒體到達 HTML 結尾時執行腳本。您可以添加“感謝您觀看”、“敬請關注!”等消息。
示例
您可以嘗試運行以下命令實現onend屬性的代碼 –
<!DOCTYPE HTML>
<html>
<body>
<video width = "300" height = "200" controls onended = "display()">
<source src = "/html5/foo.ogg" type = "video/ogg" />
Your browser does not support the video element.
</video>
<script>
function display() {
alert ("Thank you for watching! Stay tuned!");
}
</script>
</body>
</html>
登錄后復制
以上就是當媒體到達 HTML 末尾時執行腳本?的詳細內容,更多請關注www.92cms.cn其它相關文章!






