window的三种系统弹框介绍


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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        /* 001-弹出对话框,作用是提示用户 alert() */
        // alert(123);

        /* 002-弹出对话框,拥有取消和确定两个按钮,confirm()   */
        // var flag = confirm("确定要删除核按钮的密码吗?");
        /* 如果点击的是确定,返回true 取消那么返回的是false */
        // console.log(flag);

        /* 003 弹出输入框,标题 && 输入框 && 取消 && 确定*/
        // var res = prompt("请输入您的昵称?");
        var res = window.prompt("请输入您的昵称?", "小妖怪");
        /* 确定:输入框的内容 */
        /* 取消:null */
        console.log(res);
        /* 上面的这三个方法都是window的方法 */
        console.log(window.prompt == prompt, alert == window.alert); /* true trues */
    </script>
</body>

</html>


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM