檔案在 HTML 中不可用時執行指令碼?
在 HTML 中使用 onemptied 屬性可以在 HTML 中檔案不可用或為空時執行指令碼。
示例
你可以嘗試執行以下程式碼來實現 onemptied 屬性 -
<!DOCTYPE HTML>
<html>
<body>
<video width = "300" height = "200" controls onemptied ="display()">
<source src = "/html5/foo.ogg" type = "video/ogg" />
Your browser does not support the video element.
</video>
<script>
function display()
{
alert ("Sorry! Empty playlist!");
}
</script>
</body>
</html>
廣告
資料結構
網路
關係資料庫管理系統
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP