在 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>
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP