當文件在 HTML 中不可用或為空時,使用 HTML 中的 onemptied 屬性來執(zhí)行腳本。
示例
您可以嘗試運行以下代碼來實現(xiàn) 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>
登錄后復制
以上就是當HTML中的文件不可用時執(zhí)行腳本?的詳細內(nèi)容,更多請關(guān)注www.92cms.cn其它相關(guān)文章!






