JS的一些简单应用 —— 确认关闭框

关于确认是否关闭框和页面跳转的写法

<!DOCTYPE html>
<html lang="en">

<script>
    window.alert('haha');
    window.confirm('你确定要关闭吗?');
    //确认是否关闭框

    console.log(window.navigator.cookieEnabled); //true
    window.location.href = 'https://www.baidu.com/'; //页面跳转         
</script>

    <head>
        <meta charset="utf-8">
    </head>
    <body>
    </body>
</html>

确认关闭框:
这里写图片描述

猜你喜欢

转载自blog.csdn.net/dyw_666666/article/details/80345274
今日推荐