在 HTML 中為頁面解除安裝時執行指令碼?
unloaded 屬性會在網頁解除安裝時觸發。你可以嘗試執行以下程式碼在 HTML 中實現 unloaded 屬性 −
示例
<!DOCTYPE html>
<html>
<body onunload = "display()">
<h2>Tutorialspoint</h2>
<h3>Simply Easy learning</h3>
<script>
function display() {
alert("Bye!");
}
</script>
</body>
</html>
廣告
資料結構
網路
關係型資料庫管理系統
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式語言
C++
C#
MongoDB
MySQL
Javascript
PHP