<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>弹窗</title>
<script>
window.onload = function(){
alert("欢迎进入页面")
};
window.onbeforeunload = function(event){
var e = event || window.event;
e.returnValue = "你要离开页面了";
}
</script>
</head>
<body>
</body>
</html>
❤一个进入和离开页面的弹窗。但是这个离开页面测试不出来,需要有返回键才行。❤